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

Unified Diff: base/metrics/statistics_recorder.cc

Issue 1780993002: Break global impact of PersistentHistogramAllocator into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-hp
Patch Set: updated everything to use new Global class 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
Index: base/metrics/statistics_recorder.cc
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index 2bb50ad3a33da3117475170fbefe152814c3e3e4..9ecd0bf4861d1bd2bccd87b1b086c8868afa1db0 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/metrics/metrics_hashes.h"
+#include "base/metrics/persistent_histogram_allocator.h"
#include "base/stl_util.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/lock.h"
@@ -288,6 +289,14 @@ HistogramBase* StatisticsRecorder::FindHistogram(base::StringPiece name) {
if (histograms_ == NULL)
return NULL;
+ // Import histograms from known persistent storage. Histograms could have
+ // been added by other processes and they must be fetched and recognized
+ // locally. If the persistent memory segment is not shared between processes,
+ // this call does nothing.
+ GlobalHistogramAllocator* allocator = GlobalHistogramAllocator::Get();
+ if (allocator)
+ allocator->ImportHistogramsToStatisticsRecorder();
+
HistogramMap::iterator it = histograms_->find(HashMetricName(name));
if (histograms_->end() == it)
return NULL;

Powered by Google App Engine
This is Rietveld 408576698