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

Unified Diff: base/metrics/histogram_snapshot_manager.h

Issue 2871663003: Add concurrency check to HistogramSnapshotManager. (Closed)
Patch Set: disallow copy and assign Created 3 years, 7 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/metrics/histogram_snapshot_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram_snapshot_manager.h
diff --git a/base/metrics/histogram_snapshot_manager.h b/base/metrics/histogram_snapshot_manager.h
index fe26faad1138c6dbaa57f40b9d23c56eeb3ecb94..51bf92c7b55aa1bc81cf8b6b79a300640b3cbcb9 100644
--- a/base/metrics/histogram_snapshot_manager.h
+++ b/base/metrics/histogram_snapshot_manager.h
@@ -7,6 +7,7 @@
#include <stdint.h>
+#include <atomic>
#include <map>
#include <string>
#include <vector>
@@ -14,7 +15,6 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "base/metrics/histogram_base.h"
-#include "base/threading/thread_checker.h"
namespace base {
@@ -76,15 +76,19 @@ class BASE_EXPORT HistogramSnapshotManager {
void PrepareSamples(const HistogramBase* histogram,
std::unique_ptr<HistogramSamples> samples);
+ // |histogram_flattener_| handles the logistics of recording the histogram
+ // deltas.
+ HistogramFlattener* const histogram_flattener_; // Weak.
+
// For histograms, track what has been previously seen, indexed
// by the hash of the histogram name.
std::map<uint64_t, SampleInfo> known_histograms_;
- // |histogram_flattener_| handles the logistics of recording the histogram
- // deltas.
- HistogramFlattener* histogram_flattener_; // Weak.
-
- ThreadChecker thread_checker_;
+ // A flag indicating if a thread is currently doing an operation. This is
+ // used to check against concurrent access which is not supported. A Thread-
+ // Checker is not sufficient because it may be guarded by at outside lock
+ // (as is the case with cronet).
+ std::atomic<bool> is_active_;
DISALLOW_COPY_AND_ASSIGN(HistogramSnapshotManager);
};
« no previous file with comments | « no previous file | base/metrics/histogram_snapshot_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698