Index: base/metrics/histogram.cc |
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc |
index a44a2eb8888a517eef35f134737def5d9f46d760..180c36a157a52c35871a5702ce68b65e58df6376 100644 |
--- a/base/metrics/histogram.cc |
+++ b/base/metrics/histogram.cc |
@@ -94,6 +94,10 @@ Histogram* Histogram::FactoryGet(const std::string& name, |
if (maximum > kSampleType_MAX - 1) |
maximum = kSampleType_MAX - 1; |
+ DCHECK_GT(maximum, minimum); |
+ DCHECK_GT((Sample) bucket_count, 2); |
+ DCHECK_LE((Sample) bucket_count, maximum - minimum + 2); |
+ |
if (!StatisticsRecorder::FindHistogram(name, &histogram)) { |
// Extra variable is not needed... but this keeps this section basically |
// identical to other derived classes in this file (and compiler will |
@@ -816,6 +820,10 @@ Histogram* LinearHistogram::FactoryGet(const std::string& name, |
if (maximum > kSampleType_MAX - 1) |
maximum = kSampleType_MAX - 1; |
+ DCHECK_GT(maximum, minimum); |
+ DCHECK_GT((Sample) bucket_count, 2); |
+ DCHECK_LE((Sample) bucket_count, maximum - minimum + 2); |
+ |
if (!StatisticsRecorder::FindHistogram(name, &histogram)) { |
// To avoid racy destruction at shutdown, the following will be leaked. |
LinearHistogram* tentative_histogram = |