Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: webrtc/modules/desktop_capture/shared_desktop_frame.cc

Issue 1347793005: Replace Atomic32 with webrtc/base/atomicops.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix typo Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698