| Index: base/metrics/histogram_base.h
|
| diff --git a/base/metrics/histogram_base.h b/base/metrics/histogram_base.h
|
| index 302795a73fc7a4072bb4fc26ccb86461a5f790c0..69e143727645bb010b60ba78c22224d441ef2d9f 100644
|
| --- a/base/metrics/histogram_base.h
|
| +++ b/base/metrics/histogram_base.h
|
| @@ -11,9 +11,13 @@
|
| #include "base/basictypes.h"
|
| #include "base/memory/scoped_ptr.h"
|
|
|
| +class Pickle;
|
| +class PickleIterator;
|
| +
|
| namespace base {
|
|
|
| class DictionaryValue;
|
| +class HistogramBase;
|
| class HistogramSamples;
|
| class ListValue;
|
|
|
| @@ -32,6 +36,15 @@ enum BASE_EXPORT HistogramType {
|
|
|
| std::string HistogramTypeToString(HistogramType type);
|
|
|
| +// Create or find existing histogram that matches the pickled info.
|
| +// Returns NULL if the pickled data has problems.
|
| +BASE_EXPORT_PRIVATE HistogramBase* DeserializeHistogramInfo(
|
| + PickleIterator* iter);
|
| +
|
| +// Create or find existing histogram and add the samples from pickle.
|
| +// Silently returns when seeing any data problem in the pickle.
|
| +BASE_EXPORT void DeserializeHistogramAndAddSamples(PickleIterator* iter);
|
| +
|
| ////////////////////////////////////////////////////////////////////////////////
|
|
|
| class BASE_EXPORT HistogramBase {
|
| @@ -69,14 +82,22 @@ class BASE_EXPORT HistogramBase {
|
| virtual HistogramType GetHistogramType() const = 0;
|
|
|
| // Whether the histogram has construction arguments as parameters specified.
|
| - // For histograms that don't have the concept of minimum, maximum or
|
| - // bucket_count, this function always returns false.
|
| + // For histograms that don't have the concept of |minimum|, |maximum| or
|
| + // |bucket_count|, this function always returns false.
|
| virtual bool HasConstructionArguments(Sample minimum,
|
| Sample maximum,
|
| size_t bucket_count) const = 0;
|
|
|
| virtual void Add(Sample value) = 0;
|
|
|
| + virtual void AddSamples(const HistogramSamples& samples) = 0;
|
| + virtual bool AddSamplesFromPickle(PickleIterator* iter) = 0;
|
| +
|
| + // Serialize the histogram info into |pickle|.
|
| + // Note: This only serializes the construction arguments of the histogram, but
|
| + // does not serialize the samples.
|
| + bool SerializeInfo(Pickle* pickle) const;
|
| +
|
| // Snapshot the current complete set of sample data.
|
| // Override with atomic/locked snapshot if needed.
|
| virtual scoped_ptr<HistogramSamples> SnapshotSamples() const = 0;
|
| @@ -91,6 +112,9 @@ class BASE_EXPORT HistogramBase {
|
| void WriteJSON(std::string* output) const;
|
|
|
| protected:
|
| + // Subclasses should implement this function to make SerializeInfo work.
|
| + virtual bool SerializeInfoImpl(Pickle* pickle) const = 0;
|
| +
|
| // Writes information about the construction parameters in |params|.
|
| virtual void GetParameters(DictionaryValue* params) const = 0;
|
|
|
|
|