blob: 95451c4ddefba6d3c498a700f8eb2d1c3c025629 [file] [log] [blame]
niklase@google.com470e71d2011-07-07 08:21:25 +00001/*
mflodman@webrtc.org1b1cd782012-06-28 06:34:08 +00002 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
niklase@google.com470e71d2011-07-07 08:21:25 +00003 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
mflodman@webrtc.org1b1cd782012-06-28 06:34:08 +000011// TODO(mflodman) Remove this class and use ref count class in system_wrappers.
niklase@google.com470e71d2011-07-07 08:21:25 +000012
mflodman@webrtc.orge06ca3c2012-06-29 13:20:14 +000013#ifndef WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
14#define WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
niklase@google.com470e71d2011-07-07 08:21:25 +000015
pbos@webrtc.orgf5d4cb12013-05-17 13:44:48 +000016#include "webrtc/system_wrappers/interface/scoped_ptr.h"
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000017
niklase@google.com470e71d2011-07-07 08:21:25 +000018namespace webrtc {
mflodman@webrtc.orgffabb592011-11-29 17:31:21 +000019
niklase@google.com470e71d2011-07-07 08:21:25 +000020class CriticalSectionWrapper;
niklase@google.com470e71d2011-07-07 08:21:25 +000021
mflodman@webrtc.orgffabb592011-11-29 17:31:21 +000022class ViERefCount {
23 public:
24 ViERefCount();
25 ~ViERefCount();
niklase@google.com470e71d2011-07-07 08:21:25 +000026
mflodman@webrtc.org1b1cd782012-06-28 06:34:08 +000027 ViERefCount& operator++(int); // NOLINT
28 ViERefCount& operator--(int); // NOLINT
mflodman@webrtc.orgffabb592011-11-29 17:31:21 +000029
30 void Reset();
31 int GetCount() const;
32
33 private:
34 volatile int count_;
mflodman@webrtc.orgd32c4472011-12-22 14:17:53 +000035 scoped_ptr<CriticalSectionWrapper> crit_;
niklase@google.com470e71d2011-07-07 08:21:25 +000036};
37
mflodman@webrtc.orgffabb592011-11-29 17:31:21 +000038} // namespace webrtc
39
mflodman@webrtc.orge06ca3c2012-06-29 13:20:14 +000040#endif // WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_