Index: webrtc/modules/desktop_capture/shared_desktop_frame.cc |
diff --git a/webrtc/modules/desktop_capture/shared_desktop_frame.cc b/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
index 97190e047318f3811a306284ef052737a3c2bea6..10dc7aeedae331cc2f35cfe3ee09df28bbe1038f 100644 |
--- a/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
+++ b/webrtc/modules/desktop_capture/shared_desktop_frame.cc |
@@ -10,26 +10,24 @@ |
#include "webrtc/modules/desktop_capture/shared_desktop_frame.h" |
+#include "webrtc/base/atomicops.h" |
#include "webrtc/base/scoped_ptr.h" |
-#include "webrtc/system_wrappers/interface/atomic32.h" |
namespace webrtc { |
class SharedDesktopFrame::Core { |
public: |
- Core(DesktopFrame* frame) : frame_(frame) {} |
+ Core(DesktopFrame* frame) : ref_count_(0), frame_(frame) {} |
DesktopFrame* frame() { return frame_.get(); } |
- bool HasOneRef() { return ref_count_.Value() == 1; } |
+ bool HasOneRef() { return rtc::AtomicOps::AcquireLoad(&ref_count_) == 1; } |
- virtual int32_t AddRef() { |
- return ++ref_count_; |
- } |
+ virtual int32_t AddRef() { return rtc::AtomicOps::Increment(&ref_count_); } |
virtual int32_t Release() { |
int32_t ref_count; |
- ref_count = --ref_count_; |
+ ref_count = rtc::AtomicOps::Decrement(&ref_count_); |
if (ref_count == 0) |
delete this; |
return ref_count; |
@@ -38,7 +36,7 @@ class SharedDesktopFrame::Core { |
private: |
virtual ~Core() {} |
- Atomic32 ref_count_; |
+ volatile int ref_count_; |
rtc::scoped_ptr<DesktopFrame> frame_; |
RTC_DISALLOW_COPY_AND_ASSIGN(Core); |