Index: base/metrics/statistics_recorder.h |
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h |
index 2fa03f9b2f14664653b5ff6ce62d4626f91eca5b..c1f10c9908839b07b797184cb010dc9ceea7e1cd 100644 |
--- a/base/metrics/statistics_recorder.h |
+++ b/base/metrics/statistics_recorder.h |
@@ -33,6 +33,21 @@ class Lock; |
class BASE_EXPORT StatisticsRecorder { |
public: |
+ // An interface class for registering objects that can display histograms |
+ // on the chrome://histograms page. |
+ class MetricsDisplay { |
Ilya Sherman
2016/04/13 00:29:32
Optional nit: Perhaps MetricsDisplayer?
bcwhite
2016/04/13 11:58:18
Done.
|
+ public: |
+ // Writes a title string (without formatting) to |output|. |
+ virtual void WriteTitleString(std::string* output) = 0; |
+ |
+ // Writes graphs for all known histograms to |output|, optionally with |
+ // |html| formatting. If |query| is non-empty, only histograms with |
+ // that substring will be included. |
+ virtual void WriteGraphs(const std::string& query, |
+ bool html, |
Ilya Sherman
2016/04/13 00:29:32
nit: Could you use an enum rather than a bool here
bcwhite
2016/04/13 11:58:18
Done.
|
+ std::string* output) = 0; |
+ }; |
+ |
// A class used as a key for the histogram map below. It always references |
// a string owned outside of this class, likely in the value of the map. |
class StringKey : public StringPiece { |
@@ -165,6 +180,12 @@ class BASE_EXPORT StatisticsRecorder { |
// Returns the number of known histograms. |
static size_t GetHistogramCount(); |
+ // Adds an object that can display metrics. |
+ static void RegisterMetricsDisplay(MetricsDisplay* display); |
+ |
+ // Removes an object that can display metrics. |
+ static void DeregisterMetricsDisplay(MetricsDisplay* display); |
+ |
// Removes a histogram from the internal set of known ones. This can be |
// necessary during testing persistent histograms where the underlying |
// memory is being released. |