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

Unified Diff: webrtc/base/atomicops.h

Issue 2877023002: Move webrtc/{base => rtc_base} (Closed)
Patch Set: update presubmit.py and DEPS include rules Created 3 years, 6 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
« no previous file with comments | « webrtc/base/asyncudpsocket_unittest.cc ('k') | webrtc/base/atomicops_unittest.cc » ('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 a286bf01cc8c0f4d7516c50a0ecb9dda5fc84d39..3c3684814a09345e4e6c9f72102cc757611ac9e6 100644
--- a/webrtc/base/atomicops.h
+++ b/webrtc/base/atomicops.h
@@ -11,77 +11,9 @@
#ifndef WEBRTC_BASE_ATOMICOPS_H_
#define WEBRTC_BASE_ATOMICOPS_H_
-#if defined(WEBRTC_WIN)
-// Include winsock2.h before including <windows.h> to maintain consistency with
-// win32.h. We can't include win32.h directly here since it pulls in
-// headers such as basictypes.h which causes problems in Chromium where webrtc
-// exists as two separate projects, webrtc and libjingle.
-#include <winsock2.h>
-#include <windows.h>
-#endif // defined(WEBRTC_WIN)
-namespace rtc {
-class AtomicOps {
- public:
-#if defined(WEBRTC_WIN)
- // Assumes sizeof(int) == sizeof(LONG), which it is on Win32 and Win64.
- static int Increment(volatile int* i) {
- return ::InterlockedIncrement(reinterpret_cast<volatile LONG*>(i));
- }
- static int Decrement(volatile int* i) {
- return ::InterlockedDecrement(reinterpret_cast<volatile LONG*>(i));
- }
- static int AcquireLoad(volatile const int* i) {
- return *i;
- }
- static void ReleaseStore(volatile int* i, int value) {
- *i = value;
- }
- static int CompareAndSwap(volatile int* i, int old_value, int new_value) {
- return ::InterlockedCompareExchange(reinterpret_cast<volatile LONG*>(i),
- new_value,
- old_value);
- }
- // Pointer variants.
- template <typename T>
- static T* AcquireLoadPtr(T* volatile* ptr) {
- return *ptr;
- }
- template <typename T>
- static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) {
- return static_cast<T*>(::InterlockedCompareExchangePointer(
- reinterpret_cast<PVOID volatile*>(ptr), new_value, old_value));
- }
-#else
- static int Increment(volatile int* i) {
- return __sync_add_and_fetch(i, 1);
- }
- static int Decrement(volatile int* i) {
- return __sync_sub_and_fetch(i, 1);
- }
- static int AcquireLoad(volatile const int* i) {
- return __atomic_load_n(i, __ATOMIC_ACQUIRE);
- }
- static void ReleaseStore(volatile int* i, int value) {
- __atomic_store_n(i, value, __ATOMIC_RELEASE);
- }
- static int CompareAndSwap(volatile int* i, int old_value, int new_value) {
- return __sync_val_compare_and_swap(i, old_value, new_value);
- }
- // Pointer variants.
- template <typename T>
- static T* AcquireLoadPtr(T* volatile* ptr) {
- return __atomic_load_n(ptr, __ATOMIC_ACQUIRE);
- }
- template <typename T>
- static T* CompareAndSwapPtr(T* volatile* ptr, T* old_value, T* new_value) {
- return __sync_val_compare_and_swap(ptr, old_value, new_value);
- }
-#endif
-};
-
-
-
-}
+// This header is deprecated and is just left here temporarily during
+// refactoring. See https://bugs.webrtc.org/7634 for more details.
+#include "webrtc/rtc_base/atomicops.h"
#endif // WEBRTC_BASE_ATOMICOPS_H_
« no previous file with comments | « webrtc/base/asyncudpsocket_unittest.cc ('k') | webrtc/base/atomicops_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698