Index: base/metrics/statistics_recorder.h |
=================================================================== |
--- base/metrics/statistics_recorder.h (revision 147155) |
+++ base/metrics/statistics_recorder.h (working copy) |
@@ -16,6 +16,8 @@ |
#include "base/base_export.h" |
#include "base/basictypes.h" |
+#include "base/gtest_prod_util.h" |
+#include "base/lazy_instance.h" |
namespace base { |
@@ -27,10 +29,9 @@ |
public: |
typedef std::vector<Histogram*> Histograms; |
- StatisticsRecorder(); |
+ // Initializes the StatisticsRecorder system. |
+ static void Initialize(); |
- ~StatisticsRecorder(); |
- |
// Find out if histograms can now be registered into our list. |
static bool IsActive(); |
@@ -77,7 +78,6 @@ |
// pointer to be copied. |
static void GetSnapshot(const std::string& query, Histograms* snapshot); |
- |
private: |
// We keep all registered histograms in a map, from name to histogram. |
typedef std::map<std::string, Histogram*> HistogramMap; |
@@ -87,6 +87,19 @@ |
// |cached_ranges_|. |
typedef std::map<uint32, std::list<CachedRanges*>*> RangesMap; |
+ friend struct DefaultLazyInstanceTraits<StatisticsRecorder>; |
+ |
+ // Allow tests to access our innards for testing purposes. |
+ FRIEND_TEST_ALL_PREFIXES(HistogramTest, StartupShutdownTest); |
+ FRIEND_TEST_ALL_PREFIXES(HistogramTest, RecordedStartupTest); |
+ FRIEND_TEST_ALL_PREFIXES(HistogramTest, RangeTest); |
+ FRIEND_TEST_ALL_PREFIXES(HistogramTest, CustomRangeTest); |
+ FRIEND_TEST_ALL_PREFIXES(HistogramTest, CachedRangesTest); |
+ |
+ StatisticsRecorder(); |
+ |
+ ~StatisticsRecorder(); |
+ |
static HistogramMap* histograms_; |
static RangesMap* ranges_; |