Chromium Code Reviews| Index: base/metrics/sparse_histogram.h |
| diff --git a/base/metrics/sparse_histogram.h b/base/metrics/sparse_histogram.h |
| index 9ef435ed9ec36b86d360a45a41d06659b4d5e894..1b3b8a900865f34d35878d4e2e33f894ebfe35c0 100644 |
| --- a/base/metrics/sparse_histogram.h |
| +++ b/base/metrics/sparse_histogram.h |
| @@ -11,7 +11,9 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| #include "base/compiler_specific.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/metrics/histogram_base.h" |
| +#include "base/metrics/sample_map.h" |
| #include "base/synchronization/lock.h" |
| namespace base { |
| @@ -24,12 +26,13 @@ class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase { |
| virtual ~SparseHistogram(); |
| + // HistogramBase implementation: |
| virtual void Add(Sample value) OVERRIDE; |
| - |
| - virtual void SnapshotSample(std::map<Sample, Count>* sample) const; |
| virtual void WriteHTMLGraph(std::string* output) const OVERRIDE; |
| virtual void WriteAscii(std::string* output) const OVERRIDE; |
| + virtual scoped_ptr<SampleMap> SnapshotSamples() const; |
| + |
| protected: |
| // Clients should always use FactoryGet to create SparseHistogram. |
| SparseHistogram(const std::string& name); |
|
jar (doing other things)
2012/10/05 01:27:36
nit: make private, unless we have a subclass using
kaiwang
2012/10/05 03:16:17
Done.
|
| @@ -37,10 +40,10 @@ class BASE_EXPORT_PRIVATE SparseHistogram : public HistogramBase { |
| private: |
| friend class SparseHistogramTest; // For constuctor calling. |
| - std::map<Sample, Count> samples_; |
| - |
| - // Protects access to above map. |
| + // Protects access to |sample_counts_| and |redundant_count_|. |
| mutable base::Lock lock_; |
| + std::map<HistogramBase::Sample, HistogramBase::Count> sample_counts_; |
| + HistogramBase::Count redundant_count_; |
| DISALLOW_COPY_AND_ASSIGN(SparseHistogram); |
| }; |