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

Unified Diff: base/metrics/histogram.h

Issue 9113002: Prevent calling internal metrics code with invalid values. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | chrome/browser/extensions/extension_metrics_module.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/histogram.h
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 0b946136b0fb7d9046346d1914c6a66e3eb0f094..f437ffce70859b053d1d0bab58a5396fc238d563 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -430,8 +430,14 @@ class BASE_EXPORT Histogram {
};
//----------------------------------------------------------------------------
- // minimum should start from 1. 0 is invalid as a minimum. 0 is an implicit
- // default underflow bucket.
+ // For a valid histogram, input should follow these restrictions:
+ // minimum > 0
jar (doing other things) 2012/01/05 17:35:14 There is fixup code in histograms for this, so min
rkc 2012/01/06 00:08:01 Done.
+ // maximum > minimum
+ // buckets > 2 [minimum buckets needed: underflow, overflow and the range]
+ // Additionally,
+ // buckets <= (maximum - minimum + 2) - this is to ensure that we don't have
+ // more buckets than the range of numbers; having more buckets than 1 per
+ // value in the range would be nonsensical.
static Histogram* FactoryGet(const std::string& name,
Sample minimum,
Sample maximum,
« no previous file with comments | « no previous file | base/metrics/histogram.cc » ('j') | chrome/browser/extensions/extension_metrics_module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698