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

Unified Diff: ipc/ipc_message.cc

Issue 177123004: Use StaticAtomicSequenceNumber instead of subtle::Atomic32 in IPCMessage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 10 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 | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_message.cc
diff --git a/ipc/ipc_message.cc b/ipc/ipc_message.cc
index cf3a65e077f08dc767f63150d48c848b79589419..f7fe8272fd0b6746aa4bd5f67483d0027d86c788 100644
--- a/ipc/ipc_message.cc
+++ b/ipc/ipc_message.cc
@@ -4,7 +4,7 @@
#include "ipc/ipc_message.h"
-#include "base/atomicops.h"
+#include "base/atomic_sequence_num.h"
#include "base/logging.h"
#include "build/build_config.h"
@@ -14,7 +14,7 @@
namespace {
-base::subtle::Atomic32 g_ref_num = 0;
+base::StaticAtomicSequenceNumber g_ref_num;
// Create a reference number for identifying IPC messages in traces. The return
// values has the reference number stored in the upper 24 bits, leaving the low
@@ -22,7 +22,7 @@ base::subtle::Atomic32 g_ref_num = 0;
inline uint32 GetRefNumUpper24() {
base::debug::TraceLog* trace_log = base::debug::TraceLog::GetInstance();
int32 pid = trace_log ? trace_log->process_id() : 0;
- int32 count = base::subtle::NoBarrier_AtomicIncrement(&g_ref_num, 1);
+ int32 count = g_ref_num.GetNext();
tulloch 2014/02/24 19:38:10 Note that now `g_ref_num` counts from 0 instead of
// The 24 bit hash is composed of 14 bits of the count and 10 bits of the
// Process ID. With the current trace event buffer cap, the 14-bit count did
// not appear to wrap during a trace. Note that it is not a big deal if
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698