Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Unified Diff: base/metrics/statistics_recorder.h

Issue 10779040: Initialize StatisticsRecorder in Child Process to hold (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
« no previous file with comments | « base/metrics/histogram_unittest.cc ('k') | base/metrics/statistics_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698