| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_TEST_STATISTICS_DELTA_READER_H_ | 5 #ifndef BASE_TEST_STATISTICS_DELTA_READER_H_ |
| 6 #define BASE_TEST_STATISTICS_DELTA_READER_H_ | 6 #define BASE_TEST_STATISTICS_DELTA_READER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 | 15 |
| 16 class HistogramSamples; | 16 class HistogramSamples; |
| 17 | 17 |
| 18 // This class acts as a differential reader for histogram samples, enabling | 18 // This class acts as a differential reader for histogram samples, enabling |
| 19 // tests to check that metrics were recorded as they should be. | 19 // tests to check that metrics were recorded as they should be. |
| 20 // |
| 21 // This class is DEPRECATED. |
| 22 // TODO(mlerman): Remove all references to this class with UMAHistogramHelper |
| 23 // references. crbug.com/384011 |
| 20 class StatisticsDeltaReader { | 24 class StatisticsDeltaReader { |
| 21 public: | 25 public: |
| 22 StatisticsDeltaReader(); | 26 StatisticsDeltaReader(); |
| 23 ~StatisticsDeltaReader(); | 27 ~StatisticsDeltaReader(); |
| 24 | 28 |
| 25 // Returns the histogram data accumulated since this instance was created. | 29 // Returns the histogram data accumulated since this instance was created. |
| 26 // Returns NULL if no samples are available. | 30 // Returns NULL if no samples are available. |
| 27 scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation( | 31 scoped_ptr<HistogramSamples> GetHistogramSamplesSinceCreation( |
| 28 const std::string& histogram_name); | 32 const std::string& histogram_name); |
| 29 | 33 |
| 30 private: | 34 private: |
| 31 // Used to determine the histogram changes made during this instance's | 35 // Used to determine the histogram changes made during this instance's |
| 32 // lifecycle. This instance takes ownership of the samples, which are deleted | 36 // lifecycle. This instance takes ownership of the samples, which are deleted |
| 33 // when the instance is destroyed. | 37 // when the instance is destroyed. |
| 34 std::map<std::string, HistogramSamples*> original_samples_; | 38 std::map<std::string, HistogramSamples*> original_samples_; |
| 35 | 39 |
| 36 DISALLOW_COPY_AND_ASSIGN(StatisticsDeltaReader); | 40 DISALLOW_COPY_AND_ASSIGN(StatisticsDeltaReader); |
| 37 }; | 41 }; |
| 38 | 42 |
| 39 } // namespace base | 43 } // namespace base |
| 40 | 44 |
| 41 #endif // BASE_TEST_STATISTICS_DELTA_READER_H_ | 45 #endif // BASE_TEST_STATISTICS_DELTA_READER_H_ |
| OLD | NEW |