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

Unified Diff: base/metrics/statistics_recorder.h

Issue 1779503002: Fix StatisticsRecorder to handle re-entry during tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/statistics_recorder.h
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h
index 36b2f308af30bf8bc52d23a7ddfd9af69d22ccc7..314600fdb09a7a8531a60355c6047e591ce66304 100644
--- a/base/metrics/statistics_recorder.h
+++ b/base/metrics/statistics_recorder.h
@@ -130,10 +130,6 @@ class BASE_EXPORT StatisticsRecorder {
// histogram. This method is thread safe.
static OnSampleCallback FindCallback(const std::string& histogram_name);
- // Clears all of the known histograms and resets static variables to a
- // state that allows a new initialization.
- static void ResetForTesting();
-
// Removes a histogram from the internal set of known ones. This can be
// necessary during testing persistent histograms where the underlying
// memory is being released.
@@ -166,6 +162,13 @@ class BASE_EXPORT StatisticsRecorder {
StatisticsRecorder();
~StatisticsRecorder();
+ // These are copies of everything that existed when the (test) Statistics-
+ // Recorder was created. The global ones have to be moved aside to create a
+ // clean environment.
+ scoped_ptr<HistogramMap> existing_histograms_;
+ scoped_ptr<CallbackMap> existing_callbacks_;
+ scoped_ptr<RangesMap> existing_ranges_;
Alexei Svitkine (slow) 2016/03/08 20:04:12 Can this be done in a test-only subclass?
bcwhite 2016/03/08 20:23:27 Potentially. It'll require turning private member
+
static void Reset();
static void DumpHistogramsToVlog(void* instance);
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698