diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 17:25:28 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 17:25:28 +0000 |
commit | 5d91c9e739630685fbff5341abdbd1259f0e63ff (patch) | |
tree | 04e82f352e32cfa77985b707c55f661a8f733268 /base/histogram.cc | |
parent | 37e658bd7bcf3e6a6d474f1826b5b03c4485afcb (diff) | |
download | chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.zip chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.tar.gz chromium_src-5d91c9e739630685fbff5341abdbd1259f0e63ff.tar.bz2 |
base/ header cleanup. Forward declaration instead of including.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3068004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53969 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/histogram.cc')
-rw-r--r-- | base/histogram.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/base/histogram.cc b/base/histogram.cc index 2206756..31cc6a5 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(), |