andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 1 | /* |
| 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.org | 281cff8 | 2013-05-17 13:44:48 +0000 | [diff] [blame] | 16 | #include "webrtc/system_wrappers/interface/scoped_ptr.h" |
andrew@webrtc.org | b015cbe | 2012-10-22 18:19:23 +0000 | [diff] [blame] | 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | class CriticalSectionWrapper; |
| 21 | |
| 22 | class 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_ |