blob: 95451c4ddefba6d3c498a700f8eb2d1c3c025629 [file] [log] [blame]
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +00001/*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 *
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
11// TODO(mflodman) Remove this class and use ref count class in system_wrappers.
12
13#ifndef WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
14#define WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_
15
pbos@webrtc.org281cff82013-05-17 13:44:48 +000016#include "webrtc/system_wrappers/interface/scoped_ptr.h"
andrew@webrtc.orgb015cbe2012-10-22 18:19:23 +000017
18namespace webrtc {
19
20class CriticalSectionWrapper;
21
22class ViERefCount {
23 public:
24 ViERefCount();
25 ~ViERefCount();
26
27 ViERefCount& operator++(int); // NOLINT
28 ViERefCount& operator--(int); // NOLINT
29
30 void Reset();
31 int GetCount() const;
32
33 private:
34 volatile int count_;
35 scoped_ptr<CriticalSectionWrapper> crit_;
36};
37
38} // namespace webrtc
39
40#endif // WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_