| Index: base/metrics/statistics_recorder.h
|
| diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h
|
| index 3396829b43de14389839bb6185090656209f5137..bb9949df25b8259c2d1078a3279879bbe2a6cb46 100644
|
| --- a/base/metrics/statistics_recorder.h
|
| +++ b/base/metrics/statistics_recorder.h
|
| @@ -34,6 +34,33 @@ class BASE_EXPORT StatisticsRecorder {
|
| public:
|
| typedef std::vector<HistogramBase*> Histograms;
|
|
|
| + // A class for iterating over the histograms held within this global resource.
|
| + class BASE_EXPORT HistogramIterator {
|
| + public:
|
| + HistogramIterator(HistogramMap::iterator iter, bool include_persistent)
|
| + : iter_(iter),
|
| + include_persistent_(include_persistent) {}
|
| +
|
| + HistogramIterator& operator++();
|
| + HistogramIterator operator++(int) {
|
| + HistogramIterator tmp(*this);
|
| + operator++();
|
| + return tmp;
|
| + }
|
| +
|
| + bool operator==(const HistogramIterator& rhs) const {
|
| + return iter_ == rhs.iter_;
|
| + }
|
| + bool operator!=(const HistogramIterator& rhs) const {
|
| + return iter_ != rhs.iter_;
|
| + }
|
| + HistogramBase* operator*() { return iter_->second; }
|
| +
|
| + private:
|
| + HistogramMap::iterator iter_;
|
| + const bool include_persistent_;
|
| + };
|
| +
|
| // Initializes the StatisticsRecorder system. Safe to call multiple times.
|
| static void Initialize();
|
|
|
| @@ -73,6 +100,10 @@ class BASE_EXPORT StatisticsRecorder {
|
| // safe. It returns NULL if a matching histogram is not found.
|
| static HistogramBase* FindHistogram(const std::string& name);
|
|
|
| + // Support for iterating over known histograms.
|
| + static HistogramIterator begin(bool include_persistent);
|
| + static HistogramIterator end();
|
| +
|
| // GetSnapshot copies some of the pointers to registered histograms into the
|
| // caller supplied vector (Histograms). Only histograms which have |query| as
|
| // a substring are copied (an empty string will process all registered
|
| @@ -112,6 +143,7 @@ class BASE_EXPORT StatisticsRecorder {
|
| friend class HistogramSnapshotManagerTest;
|
| friend class HistogramTest;
|
| friend class JsonPrefStoreTest;
|
| + friend class SharedHistogramTest;
|
| friend class SparseHistogramTest;
|
| friend class StatisticsRecorderTest;
|
| FRIEND_TEST_ALL_PREFIXES(HistogramDeltaSerializationTest,
|
|
|