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

Unified Diff: base/histogram.cc

Issue 3068004: base/ header cleanup. Forward declaration instead of including. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: chrome_launcher_unittest.cc Created 10 years, 5 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 | « base/histogram.h ('k') | base/process_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/histogram.cc
diff --git a/base/histogram.cc b/base/histogram.cc
index 22067561978ce1c672bdab67dfa8c641797b932e..31cc6a5ad92548da72f19e6a779db047b4b2ffd3 100644
--- a/base/histogram.cc
+++ b/base/histogram.cc
@@ -84,6 +84,10 @@ Histogram::~Histogram() {
DCHECK(ValidateBucketRanges());
}
+bool Histogram::PrintEmptyBucket(size_t index) const {
+ return true;
+}
+
void Histogram::Add(int value) {
if (value >= kSampleType_MAX)
value = kSampleType_MAX - 1;
@@ -95,10 +99,18 @@ void Histogram::Add(int value) {
Accumulate(value, 1, index);
}
+void Histogram::AddBoolean(bool value) {
+ DCHECK(false);
+}
+
void Histogram::AddSampleSet(const SampleSet& sample) {
sample_.Add(sample);
}
+void Histogram::SetRangeDescriptions(const DescriptionPair descriptions[]) {
+ DCHECK(false);
+}
+
// The following methods provide a graphical histogram display.
void Histogram::WriteHTMLGraph(std::string* output) const {
// TBD(jar) Write a nice HTML bar chart, with divs an mouse-overs etc.
@@ -290,6 +302,20 @@ void Histogram::SnapshotSample(SampleSet* sample) const {
*sample = sample_;
}
+bool Histogram::HasConstructorArguments(Sample minimum, Sample maximum,
+ size_t bucket_count) {
+ return ((minimum == declared_min_) && (maximum == declared_max_) &&
+ (bucket_count == bucket_count_));
+}
+
+bool Histogram::HasConstructorTimeDeltaArguments(base::TimeDelta minimum,
+ base::TimeDelta maximum,
+ size_t bucket_count) {
+ return ((minimum.InMilliseconds() == declared_min_) &&
+ (maximum.InMilliseconds() == declared_max_) &&
+ (bucket_count == bucket_count_));
+}
+
//------------------------------------------------------------------------------
// Accessor methods
@@ -613,6 +639,10 @@ LinearHistogram::LinearHistogram(const std::string& name,
DCHECK(ValidateBucketRanges());
}
+Histogram::ClassType LinearHistogram::histogram_type() const {
+ return LINEAR_HISTOGRAM;
+}
+
void LinearHistogram::SetRangeDescriptions(
const DescriptionPair descriptions[]) {
for (int i =0; descriptions[i].description; ++i) {
@@ -671,6 +701,17 @@ scoped_refptr<Histogram> BooleanHistogram::FactoryGet(const std::string& name,
return histogram;
}
+Histogram::ClassType BooleanHistogram::histogram_type() const {
+ return BOOLEAN_HISTOGRAM;
+}
+
+void BooleanHistogram::AddBoolean(bool value) {
+ Add(value ? 1 : 0);
+}
+
+BooleanHistogram::BooleanHistogram(const std::string& name)
+ : LinearHistogram(name, 1, 2, 3) {
+}
//------------------------------------------------------------------------------
// CustomHistogram:
@@ -706,6 +747,10 @@ scoped_refptr<Histogram> CustomHistogram::FactoryGet(
return histogram;
}
+Histogram::ClassType CustomHistogram::histogram_type() const {
+ return CUSTOM_HISTOGRAM;
+}
+
CustomHistogram::CustomHistogram(const std::string& name,
const std::vector<int>& custom_ranges)
: Histogram(name, custom_ranges[1], custom_ranges.back(),
« no previous file with comments | « base/histogram.h ('k') | base/process_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698