| Index: base/metrics/histogram.cc
|
| diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
|
| index a44a2eb8888a517eef35f134737def5d9f46d760..a6f2b27b9005eb560cfd5c419acd2692f7d54931 100644
|
| --- a/base/metrics/histogram.cc
|
| +++ b/base/metrics/histogram.cc
|
| @@ -1,4 +1,4 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| @@ -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 =
|
|
|