niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 1 | /* |
mflodman@webrtc.org | 1b1cd78 | 2012-06-28 06:34:08 +0000 | [diff] [blame] | 2 | * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 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 | |
mflodman@webrtc.org | 1b1cd78 | 2012-06-28 06:34:08 +0000 | [diff] [blame] | 11 | // TODO(mflodman) Remove this class and use ref count class in system_wrappers. |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 12 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 13 | #ifndef WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_ |
| 14 | #define WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_ |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 15 | |
pbos@webrtc.org | f5d4cb1 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 16 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 17 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 18 | namespace webrtc { |
mflodman@webrtc.org | ffabb59 | 2011-11-29 17:31:21 +0000 | [diff] [blame] | 19 | |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 20 | class CriticalSectionWrapper; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 21 | |
mflodman@webrtc.org | ffabb59 | 2011-11-29 17:31:21 +0000 | [diff] [blame] | 22 | class ViERefCount { |
| 23 | public: |
| 24 | ViERefCount(); |
| 25 | ~ViERefCount(); |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 26 | |
mflodman@webrtc.org | 1b1cd78 | 2012-06-28 06:34:08 +0000 | [diff] [blame] | 27 | ViERefCount& operator++(int); // NOLINT |
| 28 | ViERefCount& operator--(int); // NOLINT |
mflodman@webrtc.org | ffabb59 | 2011-11-29 17:31:21 +0000 | [diff] [blame] | 29 | |
| 30 | void Reset(); |
| 31 | int GetCount() const; |
| 32 | |
| 33 | private: |
| 34 | volatile int count_; |
mflodman@webrtc.org | d32c447 | 2011-12-22 14:17:53 +0000 | [diff] [blame] | 35 | scoped_ptr<CriticalSectionWrapper> crit_; |
niklase@google.com | 470e71d | 2011-07-07 08:21:25 +0000 | [diff] [blame] | 36 | }; |
| 37 | |
mflodman@webrtc.org | ffabb59 | 2011-11-29 17:31:21 +0000 | [diff] [blame] | 38 | } // namespace webrtc |
| 39 | |
mflodman@webrtc.org | e06ca3c | 2012-06-29 13:20:14 +0000 | [diff] [blame] | 40 | #endif // WEBRTC_VIDEO_ENGINE_VIE_REF_COUNT_H_ |