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

Unified Diff: base/debug/activity_tracker.h

Issue 2673083003: Fix some issues with atomics in the activity tracker. (Closed)
Patch Set: Created 3 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 | « no previous file | base/debug/activity_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/debug/activity_tracker.h
diff --git a/base/debug/activity_tracker.h b/base/debug/activity_tracker.h
index 2d3c2bc7dbaf3666540cb9e7dda55e179685235a..348591957cbd9ed6b414cd91bf57e8453a22220f 100644
--- a/base/debug/activity_tracker.h
+++ b/base/debug/activity_tracker.h
@@ -21,6 +21,7 @@
#include <string>
#include <vector>
+#include "base/atomicops.h"
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
@@ -39,6 +40,7 @@ class FilePath;
class Lock;
class PlatformThreadHandle;
class Process;
+class StaticAtomicSequenceNumber;
class WaitableEvent;
namespace debug {
@@ -463,7 +465,7 @@ class BASE_EXPORT ActivityUserData {
// This ID is used to create unique indentifiers for user data so that it's
// possible to tell if the information has been overwritten.
- static std::atomic<uint32_t> next_id_;
+ static StaticAtomicSequenceNumber next_id_;
DISALLOW_COPY_AND_ASSIGN(ActivityUserData);
};
@@ -740,7 +742,10 @@ class BASE_EXPORT GlobalActivityTracker {
int stack_depth);
// Gets the global activity-tracker or null if none exists.
- static GlobalActivityTracker* Get() { return g_tracker_; }
+ static GlobalActivityTracker* Get() {
+ return reinterpret_cast<GlobalActivityTracker*>(
+ subtle::NoBarrier_Load(&g_tracker_));
+ }
// Gets the persistent-memory-allocator in which data is stored. Callers
// can store additional records here to pass more information to the
@@ -906,7 +911,7 @@ class BASE_EXPORT GlobalActivityTracker {
base::Lock modules_lock_;
// The active global activity tracker.
- static GlobalActivityTracker* g_tracker_;
+ static subtle::AtomicWord g_tracker_;
DISALLOW_COPY_AND_ASSIGN(GlobalActivityTracker);
};
« no previous file with comments | « no previous file | base/debug/activity_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698