Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: base/metrics/histogram.cc

Issue 2381893003: Convert DCHECKs to CHECKs for histogram types (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Histogram is an object that aggregates statistics, and can summarize them in 5 // Histogram is an object that aggregates statistics, and can summarize them in
6 // various forms, including ASCII graphical, HTML, and numerically (as a 6 // various forms, including ASCII graphical, HTML, and numerically (as a
7 // vector of numbers corresponding to each of the aggregating buckets). 7 // vector of numbers corresponding to each of the aggregating buckets).
8 // See header file for details and examples. 8 // See header file for details and examples.
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 histogram == tentative_histogram_ptr); 209 histogram == tentative_histogram_ptr);
210 } 210 }
211 211
212 // Update report on created histograms. 212 // Update report on created histograms.
213 ReportHistogramActivity(*histogram, HISTOGRAM_CREATED); 213 ReportHistogramActivity(*histogram, HISTOGRAM_CREATED);
214 } else { 214 } else {
215 // Update report on lookup histograms. 215 // Update report on lookup histograms.
216 ReportHistogramActivity(*histogram, HISTOGRAM_LOOKUP); 216 ReportHistogramActivity(*histogram, HISTOGRAM_LOOKUP);
217 } 217 }
218 218
219 DCHECK_EQ(histogram_type_, histogram->GetHistogramType()) << name_; 219 CHECK_EQ(histogram_type_, histogram->GetHistogramType()) << name_;
220 if (bucket_count_ != 0 && 220 if (bucket_count_ != 0 &&
221 !histogram->HasConstructionArguments(minimum_, maximum_, bucket_count_)) { 221 !histogram->HasConstructionArguments(minimum_, maximum_, bucket_count_)) {
222 // The construction arguments do not match the existing histogram. This can 222 // The construction arguments do not match the existing histogram. This can
223 // come about if an extension updates in the middle of a chrome run and has 223 // come about if an extension updates in the middle of a chrome run and has
224 // changed one of them, or simply by bad code within Chrome itself. We 224 // changed one of them, or simply by bad code within Chrome itself. We
225 // return NULL here with the expectation that bad code in Chrome will crash 225 // return NULL here with the expectation that bad code in Chrome will crash
226 // on dereference, but extension/Pepper APIs will guard against NULL and not 226 // on dereference, but extension/Pepper APIs will guard against NULL and not
227 // crash. 227 // crash.
228 DLOG(ERROR) << "Histogram " << name_ << " has bad construction arguments"; 228 DLOG(ERROR) << "Histogram " << name_ << " has bad construction arguments";
229 return nullptr; 229 return nullptr;
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 Sample sample = custom_ranges[i]; 1178 Sample sample = custom_ranges[i];
1179 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1) 1179 if (sample < 0 || sample > HistogramBase::kSampleType_MAX - 1)
1180 return false; 1180 return false;
1181 if (sample != 0) 1181 if (sample != 0)
1182 has_valid_range = true; 1182 has_valid_range = true;
1183 } 1183 }
1184 return has_valid_range; 1184 return has_valid_range;
1185 } 1185 }
1186 1186
1187 } // namespace base 1187 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | base/metrics/sparse_histogram.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698