Index: base/metrics/histogram_base.cc |
diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc |
index de34c79d4b4bfde9b063654e17e7db2cc880f38c..6b3f69c2c047a63198d6cf69e94ec6e29336e8b7 100644 |
--- a/base/metrics/histogram_base.cc |
+++ b/base/metrics/histogram_base.cc |
@@ -12,6 +12,7 @@ |
#include "base/metrics/histogram.h" |
#include "base/metrics/histogram_samples.h" |
#include "base/metrics/sparse_histogram.h" |
+#include "base/metrics/statistics_recorder.h" |
#include "base/pickle.h" |
#include "base/process/process_handle.h" |
#include "base/strings/stringprintf.h" |
@@ -117,6 +118,16 @@ void HistogramBase::WriteJSON(std::string* output) const { |
serializer.Serialize(root); |
} |
+void HistogramBase::FindAndRunCallback(HistogramBase::Sample sample) const { |
+ if ((flags_ & kCallbackExists) == 0) |
+ return; |
+ |
+ StatisticsRecorder::OnSampleCallback cb = |
+ StatisticsRecorder::FindCallback(histogram_name()); |
+ if (!cb.is_null()) |
+ cb.Run(sample); |
+} |
+ |
void HistogramBase::WriteAsciiBucketGraph(double current_size, |
double max_size, |
std::string* output) const { |