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

Unified Diff: third_party/tcmalloc/chromium/src/base/atomicops_internals_portable.h

Issue 1549913002: tcmalloc: Use C++11 atomics where appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: actually Created 5 years 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 | « third_party/tcmalloc/chromium/src/base/atomicops-internals-x86.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/base/atomicops_internals_portable.h
diff --git a/base/atomicops_internals_portable.h b/third_party/tcmalloc/chromium/src/base/atomicops_internals_portable.h
similarity index 97%
copy from base/atomicops_internals_portable.h
copy to third_party/tcmalloc/chromium/src/base/atomicops_internals_portable.h
index d28561076dd5f300710c090ebc6d67cca2888b39..f62c8f6468b8aa3efc133b8489c4424e2aa56bda 100644
--- a/base/atomicops_internals_portable.h
+++ b/third_party/tcmalloc/chromium/src/base/atomicops_internals_portable.h
@@ -33,6 +33,10 @@
#define BASE_ATOMICOPS_INTERNALS_PORTABLE_H_
#include <atomic>
+#include <stdint.h>
+
+typedef int32_t Atomic32;
+#define BASE_HAS_ATOMIC64 1 // Use only in tests and base/atomic*
JF 2015/12/26 00:27:24 I'm not sure I understand the comment: isn't this
Nico 2015/12/26 04:13:03 It's like this in the x86 version this patch delet
JF 2015/12/26 15:56:15 Is it required though? If so, could we only suppor
Nico 2015/12/26 16:35:05 In practice, there are three non-test uses of atom
JF 2015/12/26 16:58:37 OK thanks for looking into it! Yes, I think 2 can
namespace base {
namespace subtle {
@@ -137,7 +141,8 @@ inline Atomic32 Release_Load(volatile const Atomic32* ptr) {
return ((AtomicLocation32)ptr)->load(std::memory_order_relaxed);
}
-#if defined(ARCH_CPU_64_BITS)
+#if defined(BASE_HAS_ATOMIC64)
+typedef int64_t Atomic64;
typedef volatile std::atomic<Atomic64>* AtomicLocation64;
static_assert(sizeof(*(AtomicLocation64) nullptr) == sizeof(Atomic64),
@@ -219,8 +224,7 @@ inline Atomic64 Release_Load(volatile const Atomic64* ptr) {
MemoryBarrier();
return ((AtomicLocation64)ptr)->load(std::memory_order_relaxed);
}
-
-#endif // defined(ARCH_CPU_64_BITS)
+#endif // defined(BASE_HAS_ATOMIC64)
} // namespace subtle
} // namespace base
« no previous file with comments | « third_party/tcmalloc/chromium/src/base/atomicops-internals-x86.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698