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

Unified Diff: webrtc/base/atomicops.h

Issue 1453093002: Revert of Create rtc::AtomicInt POD struct. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | webrtc/base/criticalsection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/atomicops.h
diff --git a/webrtc/base/atomicops.h b/webrtc/base/atomicops.h
index 4c8ea898d7ff996ece12580689d7e60fc558da8d..a863566a670aad0b3d4904f0040c3c20ad845461 100644
--- a/webrtc/base/atomicops.h
+++ b/webrtc/base/atomicops.h
@@ -20,10 +20,7 @@
#include <windows.h>
#endif // defined(WEBRTC_WIN)
-#include "webrtc/base/constructormagic.h"
-
namespace rtc {
-
class AtomicOps {
public:
#if defined(WEBRTC_WIN)
@@ -64,46 +61,8 @@
#endif
};
-// POD struct version of AtomicOps, prevents accidental non-atomic operator
-// usage (such as ++, -- or =). Functions are static, so that the AtomicInt::
-// prefix must be present in the code, clearly labeling the operations as
-// atomic.
-struct AtomicInt {
- AtomicInt() : AtomicInt(0) {}
- explicit AtomicInt(int value) : value_(value) {}
- // Atomically increments |i|, returns the resulting incremented value.
- static int Increment(AtomicInt* i) {
- return AtomicOps::Increment(&i->value_);
- }
- // Atomically decrements |i|, returns the resulting decremented value.
- static int Decrement(AtomicInt* i) {
- return AtomicOps::Decrement(&i->value_);
- }
-
- // Atomically loads |i|.
- static int AcquireLoad(const AtomicInt* i) {
- return AtomicOps::AcquireLoad(&i->value_);
- }
-
- // Atomically stores |value| in |i|.
- static void ReleaseStore(AtomicInt* i, int value) {
- AtomicOps::ReleaseStore(&i->value_, value);
- }
-
- // Attempts to compare-and-swaps |old_value| for |new_value| in |i| , returns
- // |i|'s initial value. If equal to |old_value|, then the CAS succeeded,
- // otherwise no operation is performed.
- static int CompareAndSwap(AtomicInt* i, int old_value, int new_value) {
- return AtomicOps::CompareAndSwap(&i->value_, old_value, new_value);
- }
-
- private:
- volatile int value_;
-
- RTC_DISALLOW_COPY_AND_ASSIGN(AtomicInt);
-};
}
#endif // WEBRTC_BASE_ATOMICOPS_H_
« no previous file with comments | « no previous file | webrtc/base/criticalsection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698