Index: base/metrics/statistics_recorder.h |
diff --git a/base/metrics/statistics_recorder.h b/base/metrics/statistics_recorder.h |
index 6c436c292e6987027276e0cdee49e60787ba1280..fcbc02855b2ddbdd92c575465b3c9160d1395277 100644 |
--- a/base/metrics/statistics_recorder.h |
+++ b/base/metrics/statistics_recorder.h |
@@ -33,6 +33,26 @@ class Lock; |
class BASE_EXPORT StatisticsRecorder { |
public: |
+ // An interface class for registering objects that can display histograms |
+ // on the chrome://histograms page. |
+ class MetricsDisplayer { |
+ public: |
+ enum DisplayType { |
+ DISPLAY_TEXT_PLAIN, |
+ DISPLAY_TEXT_HTML, |
+ }; |
+ |
+ // 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, |
+ DisplayType format, |
+ 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 +185,12 @@ class BASE_EXPORT StatisticsRecorder { |
// Returns the number of known histograms. |
static size_t GetHistogramCount(); |
+ // Adds an object that can display metrics. |
+ static void RegisterMetricsDisplayer(MetricsDisplayer* display); |
+ |
+ // Removes an object that can display metrics. |
+ static void DeregisterMetricsDisplayer(MetricsDisplayer* 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. |