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

Unified Diff: base/test/histogram_tester.cc

Issue 1471073007: Reorganize histograms for persistence. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shmem-alloc
Patch Set: addressed review comments by Alexei Created 5 years 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/statistics_recorder.cc ('k') | components/metrics/histogram_encoder_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/histogram_tester.cc
diff --git a/base/test/histogram_tester.cc b/base/test/histogram_tester.cc
index 7fcde6d60eebd4acd57d822aec9fbeca37798215..8ba09847fe751f71effcf41cd0e54841d16cc67a 100644
--- a/base/test/histogram_tester.cc
+++ b/base/test/histogram_tester.cc
@@ -6,6 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_samples.h"
+#include "base/metrics/metrics_hashes.h"
#include "base/metrics/sample_map.h"
#include "base/metrics/statistics_recorder.h"
#include "base/stl_util.h"
@@ -121,8 +122,10 @@ scoped_ptr<HistogramSamples> HistogramTester::GetHistogramSamplesSinceCreation(
// response which is independent of the previously run tests, this method
// creates empty samples in the absence of the histogram, rather than
// returning null.
- if (!histogram)
- return scoped_ptr<HistogramSamples>(new SampleMap);
+ if (!histogram) {
+ return scoped_ptr<HistogramSamples>(
+ new SampleMap(HashMetricName(histogram_name)));
+ }
scoped_ptr<HistogramSamples> named_samples(histogram->SnapshotSamples());
auto original_samples_it = histograms_snapshot_.find(histogram_name);
if (original_samples_it != histograms_snapshot_.end())
« no previous file with comments | « base/metrics/statistics_recorder.cc ('k') | components/metrics/histogram_encoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698