Index: chrome/browser/chromeos/external_metrics.cc |
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc |
index ab5d2b4f8209760cb3ae4b00e180861f2768cc1d..01a91d632a3f08fa541af7e76d9a877c20d77c60 100644 |
--- a/chrome/browser/chromeos/external_metrics.cc |
+++ b/chrome/browser/chromeos/external_metrics.cc |
@@ -34,6 +34,17 @@ namespace chromeos { |
// The interval between external metrics collections in seconds |
static const int kExternalMetricsCollectionIntervalSeconds = 30; |
+class SystemHistogram : public base::Histogram { |
+ public: |
+ static bool CheckValues(const std::string& name, |
+ int minimum, |
+ int maximum, |
+ size_t bucket_count) { |
hshi1
2012/08/03 02:24:24
nit: please vertically left-align the arguments
zel
2012/08/03 02:29:45
Done.
|
+ return base::Histogram::InspectConstructionArguments( |
+ name, &minimum, &maximum, &bucket_count); |
+ } |
+}; |
+ |
ExternalMetrics::ExternalMetrics() |
: test_recorder_(NULL) { |
} |
@@ -89,6 +100,14 @@ void ExternalMetrics::RecordHistogram(const char* histogram_data) { |
LOG(ERROR) << "bad histogram request: " << histogram_data; |
return; |
} |
+ |
+ if (!SystemHistogram::CheckValues(name, min, max, nbuckets)) { |
+ LOG(ERROR) << "Invalid histogram " << name |
+ << ", min=" << min |
+ << ", max=" << max |
+ << ", nbuckets=" << nbuckets; |
+ return; |
+ } |
// Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram |
// instance and thus only work if |name| is constant. |
base::Histogram* counter = base::Histogram::FactoryGet( |