Index: base/metrics/histogram_base.cc |
diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc |
index bcfb57feb231ce7be9b31bbf4eb34b0e8b441b0d..2854fd4d0fb15d473b41b5f2d61c86fc788f1e53 100644 |
--- a/base/metrics/histogram_base.cc |
+++ b/base/metrics/histogram_base.cc |
@@ -9,6 +9,10 @@ |
#include "base/logging.h" |
#include "base/json/json_string_value_serializer.h" |
#include "base/memory/scoped_ptr.h" |
+#include "base/metrics/histogram.h" |
+#include "base/metrics/histogram_samples.h" |
+#include "base/metrics/sparse_histogram.h" |
+#include "base/pickle.h" |
#include "base/values.h" |
namespace base { |
@@ -39,6 +43,28 @@ HistogramBase::HistogramBase(const std::string& name) |
HistogramBase::~HistogramBase() {} |
+// static |
+HistogramBase* HistogramBase::DeserializeHistogramInfo(PickleIterator* iter) { |
+ int type; |
+ if (!iter->ReadInt(&type)) |
+ return NULL; |
+ |
+ switch (type) { |
+ case HISTOGRAM: |
+ return Histogram::DeserializeHistogramInfo(iter); |
+ case LINEAR_HISTOGRAM: |
+ return LinearHistogram::DeserializeHistogramInfo(iter); |
+ case BOOLEAN_HISTOGRAM: |
+ return BooleanHistogram::DeserializeHistogramInfo(iter); |
+ case CUSTOM_HISTOGRAM: |
+ return CustomHistogram::DeserializeHistogramInfo(iter); |
+ case SPARSE_HISTOGRAM: |
+ return SparseHistogram::DeserializeHistogramInfo(iter); |
+ default: |
+ return NULL; |
+ } |
+} |
+ |
void HistogramBase::SetFlags(int32 flags) { |
flags_ |= flags; |
} |
@@ -47,6 +73,12 @@ void HistogramBase::ClearFlags(int32 flags) { |
flags_ &= ~flags; |
} |
+bool HistogramBase::SerializeInfo(Pickle* pickle) const { |
+ if (!pickle->WriteInt(GetHistogramType())) |
+ return false; |
+ return SerializeInfoImpl(pickle); |
+} |
+ |
void HistogramBase::WriteJSON(std::string* output) const { |
Count count; |
scoped_ptr<ListValue> buckets(new ListValue()); |