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

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: addressed review comments by Alexei 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/histogram.cc
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index ea4f8167fa28cc7098ce233cddbd7ed77fd23a77..f89d770b88443e630ffdfd0efa56e90c35f55969 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -128,9 +128,7 @@ class Histogram::Factory {
// Perform any required datafill on the just-created histogram. If
// overridden, be sure to call the "super" version.
Alexei Svitkine (slow) 2016/03/14 18:48:59 Nit: Remove second sentence, since super version i
bcwhite 2016/03/15 00:00:21 It is, but there is no guarantee it will always re
- virtual void FillHistogram(HistogramBase* histogram) {
- histogram->SetFlags(flags_);
- }
+ 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 +170,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 +179,6 @@ HistogramBase* Histogram::Factory::Build() {
PersistentMemoryAllocator* allocator =
GetPersistentHistogramMemoryAllocator();
if (allocator) {
- flags_ |= HistogramBase::kIsPersistent;
tentative_histogram = AllocatePersistentHistogram(
allocator,
histogram_type_,
@@ -200,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_);
Alexei Svitkine (slow) 2016/03/14 18:49:00 Nit: Put this inside HeapAlloc()
bcwhite 2016/03/15 00:00:21 It would have to be done inside every HeapAlloc an
Alexei Svitkine (slow) 2016/03/16 15:25:43 To me, it seem a small implementation detail that
bcwhite 2016/03/16 15:42:48 I was thinking the same: It would be best as a cto
}
FillHistogram(tentative_histogram);

Powered by Google App Engine
This is Rietveld 408576698