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; |