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

Unified Diff: base/metrics/histogram.cc

Issue 1734033003: Add support for persistent sparse histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased 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/base.gypi ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index cd6d6bea0875ee7f399700759bbf89374bf2e4f3..35197e26e395a9d08bd4bd9826938241e37754fe 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -127,10 +127,9 @@ class Histogram::Factory {
}
// Perform any required datafill on the just-created histogram. If
- // overridden, be sure to call the "super" version.
- virtual void FillHistogram(HistogramBase* histogram) {
- histogram->SetFlags(flags_);
- }
+ // overridden, be sure to call the "super" version -- this method may not
+ // always remain empty.
+ virtual void FillHistogram(HistogramBase* histogram) {}
// These values are protected (instead of private) because they need to
// be accessible to methods of sub-classes in order to avoid passing
@@ -172,7 +171,7 @@ HistogramBase* Histogram::Factory::Build() {
}
// Try to create the histogram using a "persistent" allocator. As of
- // 2015-01-14, the availability of such is controlled by a base::Feature
+ // 2016-02-25, the availability of such is controlled by a base::Feature
// that is off by default. If the allocator doesn't exist or if
// allocating from it fails, code below will allocate the histogram from
// the process heap.
@@ -181,7 +180,6 @@ HistogramBase* Histogram::Factory::Build() {
PersistentHistogramAllocator* allocator =
PersistentHistogramAllocator::GetGlobalAllocator();
if (allocator) {
- flags_ |= HistogramBase::kIsPersistent;
tentative_histogram = allocator->AllocateHistogram(
histogram_type_,
name_,
@@ -199,6 +197,7 @@ HistogramBase* Histogram::Factory::Build() {
DCHECK(!allocator); // Shouldn't have failed.
flags_ &= ~HistogramBase::kIsPersistent;
tentative_histogram = HeapAlloc(registered_ranges);
+ tentative_histogram->SetFlags(flags_);
}
FillHistogram(tentative_histogram.get());
« no previous file with comments | « base/base.gypi ('k') | base/metrics/histogram_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698