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

Unified Diff: base/metrics/histogram.h

Issue 8506038: Support using UMA_HISTOGRAM_CUSTOM_ENUMERATION from the renderer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 1 month 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 | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.h
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index e5f0d046725b2547a600e7925f1843c91ce34c25..115c9d830a313b02eb34fc4445bfefc3482956f3 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -48,6 +48,7 @@
#include "base/atomicops.h"
#include "base/base_export.h"
+#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/logging.h"
#include "base/time.h"
@@ -482,6 +483,7 @@ class BASE_EXPORT Histogram {
// Pickle class to flatten the object.
static std::string SerializeHistogramInfo(const Histogram& histogram,
const SampleSet& snapshot);
+
// The following method accepts a list of pickled histograms and
// builds a histogram and updates shadow copy of histogram data in the
// browser process.
@@ -530,6 +532,12 @@ class BASE_EXPORT Histogram {
virtual ~Histogram();
+ // Serialize the histogram's ranges to |*pickle|, returning true on success.
+ // Most subclasses can leave this no-op implementation, but some will want to
+ // override it, especially if the ranges cannot be re-derived from other
+ // serialized parameters.
+ virtual bool SerializeRanges(Pickle* pickle) const;
+
// Initialize ranges_ mapping in cached_ranges_.
void InitializeBucketRange();
@@ -739,10 +747,18 @@ class BASE_EXPORT CustomHistogram : public Histogram {
static std::vector<Sample> ArrayToCustomRanges(const Sample* values,
size_t num_values);
+ // Helper for deserializing CustomHistograms. |*ranges| should already be
+ // correctly sized before this call. Return true on success.
+ static bool DeserializeRanges(void** iter, const Pickle& pickle,
+ std::vector<Histogram::Sample>* ranges);
+
+
protected:
CustomHistogram(const std::string& name,
const std::vector<Sample>& custom_ranges);
+ virtual bool SerializeRanges(Pickle* pickle) const OVERRIDE;
+
// Initialize ranges_ mapping in cached_ranges_.
void InitializedCustomBucketRange(const std::vector<Sample>& custom_ranges);
virtual double GetBucketSize(Count current, size_t i) const;
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698