summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 04:12:17 +0000
committerkaiwang@chromium.org <kaiwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-23 04:12:17 +0000
commitde415556289c07f6a28bec79405d413460b186d2 (patch)
tree6664e471f3383e96c9f768750ad25d75cab567dc
parent042b62dec29c560ccf3e5bfdbf658c11adb56f0b (diff)
downloadchromium_src-de415556289c07f6a28bec79405d413460b186d2.zip
chromium_src-de415556289c07f6a28bec79405d413460b186d2.tar.gz
chromium_src-de415556289c07f6a28bec79405d413460b186d2.tar.bz2
Only HistogramBase is used outside of base/metrics.
So client code of histogram will see a simpler interface. This also makes adding SparseHistogram to existing metrics framework possible. This CL depends on https://codereview.chromium.org/11682003/ So please review that one first. TBR=sky@chromium.org,erikwright@chromium.org BUG=139612 Review URL: https://chromiumcodereview.appspot.com/11615008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178242 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/message_loop.h4
-rw-r--r--base/metrics/histogram.cc58
-rw-r--r--base/metrics/histogram.h67
-rw-r--r--base/metrics/histogram_base.cc8
-rw-r--r--base/metrics/histogram_base.h5
-rw-r--r--base/metrics/histogram_unittest.cc114
-rw-r--r--base/metrics/statistics_recorder_unittest.cc88
-rw-r--r--chrome/browser/autocomplete/autocomplete_controller.cc2
-rw-r--r--chrome/browser/autocomplete/history_quick_provider.cc2
-rw-r--r--chrome/browser/autocomplete/shortcuts_provider.cc2
-rw-r--r--chrome/browser/autofill/autofill_metrics.cc4
-rw-r--r--chrome/browser/captive_portal/captive_portal_service.cc4
-rw-r--r--chrome/browser/chrome_browser_main.cc2
-rw-r--r--chrome/browser/chromeos/boot_times_loader.cc8
-rw-r--r--chrome/browser/chromeos/external_metrics.cc4
-rw-r--r--chrome/browser/chromeos/login/user_image_manager_impl.cc4
-rw-r--r--chrome/browser/extensions/api/metrics/metrics.cc2
-rw-r--r--chrome/browser/extensions/extension_service.cc8
-rw-r--r--chrome/browser/instant/instant_controller.cc4
-rw-r--r--chrome/browser/jankometer.cc4
-rw-r--r--chrome/browser/metrics/thread_watcher.h8
-rw-r--r--chrome/browser/net/load_time_stats.cc2
-rw-r--r--chrome/browser/net/load_time_stats.h5
-rw-r--r--chrome/browser/net/network_stats.cc36
-rw-r--r--chrome/browser/net/url_info.cc4
-rw-r--r--chrome/browser/predictors/resource_prefetch_predictor.cc6
-rw-r--r--chrome/browser/sessions/session_restore.cc4
-rw-r--r--chrome/browser/signin/token_service.cc4
-rw-r--r--chrome/browser/ui/webui/metrics_handler.cc4
-rw-r--r--chrome/common/startup_metric_utils.cc4
-rw-r--r--content/browser/gpu/gpu_util.cc6
-rw-r--r--content/browser/loader/buffered_resource_handler.cc12
-rw-r--r--content/browser/zygote_host/zygote_host_impl_linux.cc5
-rw-r--r--content/renderer/render_thread_impl.cc2
-rw-r--r--content/renderer/render_widget.cc4
-rw-r--r--content/renderer/renderer_main.cc2
-rw-r--r--net/base/mime_sniffer.cc26
-rw-r--r--net/cookies/cookie_monster.h25
-rw-r--r--net/cookies/cookie_monster_unittest.cc2
-rw-r--r--net/disk_cache/histogram_macros.h6
-rw-r--r--net/socket/client_socket_pool_histograms.cc9
-rw-r--r--net/socket/client_socket_pool_histograms.h10
-rw-r--r--sql/connection.cc4
-rw-r--r--third_party/leveldatabase/env_chromium.cc6
-rw-r--r--ui/base/events/event.cc4
-rw-r--r--webkit/glue/webkitplatformsupport_impl.cc8
-rw-r--r--webkit/plugins/ppapi/ppb_uma_private_impl.cc12
47 files changed, 317 insertions, 297 deletions
diff --git a/base/message_loop.h b/base/message_loop.h
index d046124..446a520 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -42,7 +42,7 @@
#endif
namespace base {
-class Histogram;
+class HistogramBase;
class RunLoop;
class ThreadTaskRunnerHandle;
#if defined(OS_ANDROID)
@@ -490,7 +490,7 @@ class BASE_EXPORT MessageLoop : public base::MessagePump::Delegate {
std::string thread_name_;
// A profiling histogram showing the counts of various messages and events.
- base::Histogram* message_histogram_;
+ base::HistogramBase* message_histogram_;
// An incoming queue of tasks that are acquired under a mutex for processing
// on this instance's thread. These tasks have not yet been sorted out into
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index d5da371..2e94841 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -107,11 +107,11 @@ void CheckCorruption(const Histogram& histogram, bool new_histogram) {
CHECK(histogram.bucket_ranges()->HasValidChecksum());
}
-Histogram* Histogram::FactoryGet(const string& name,
- Sample minimum,
- Sample maximum,
- size_t bucket_count,
- int32 flags) {
+HistogramBase* Histogram::FactoryGet(const string& name,
+ Sample minimum,
+ Sample maximum,
+ size_t bucket_count,
+ int32 flags) {
bool valid_arguments =
InspectConstructionArguments(name, &minimum, &maximum, &bucket_count);
DCHECK(valid_arguments);
@@ -140,11 +140,11 @@ Histogram* Histogram::FactoryGet(const string& name,
return histogram;
}
-Histogram* Histogram::FactoryTimeGet(const string& name,
- TimeDelta minimum,
- TimeDelta maximum,
- size_t bucket_count,
- int32 flags) {
+HistogramBase* Histogram::FactoryTimeGet(const string& name,
+ TimeDelta minimum,
+ TimeDelta maximum,
+ size_t bucket_count,
+ int32 flags) {
return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(),
bucket_count, flags);
}
@@ -197,10 +197,6 @@ void Histogram::InitializeBucketRanges(Sample minimum,
ranges->ResetChecksum();
}
-void Histogram::AddBoolean(bool value) {
- DCHECK(false);
-}
-
// static
const int Histogram::kCommonRaceBasedCountMismatch = 5;
@@ -574,25 +570,25 @@ void Histogram::GetCountAndBucketData(Count* count, ListValue* buckets) const {
LinearHistogram::~LinearHistogram() {}
-Histogram* LinearHistogram::FactoryGet(const string& name,
- Sample minimum,
- Sample maximum,
- size_t bucket_count,
- int32 flags) {
+HistogramBase* LinearHistogram::FactoryGet(const string& name,
+ Sample minimum,
+ Sample maximum,
+ size_t bucket_count,
+ int32 flags) {
return FactoryGetWithRangeDescription(
name, minimum, maximum, bucket_count, flags, NULL);
}
-Histogram* LinearHistogram::FactoryTimeGet(const string& name,
- TimeDelta minimum,
- TimeDelta maximum,
- size_t bucket_count,
- int32 flags) {
+HistogramBase* LinearHistogram::FactoryTimeGet(const string& name,
+ TimeDelta minimum,
+ TimeDelta maximum,
+ size_t bucket_count,
+ int32 flags) {
return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(),
bucket_count, flags);
}
-Histogram* LinearHistogram::FactoryGetWithRangeDescription(
+HistogramBase* LinearHistogram::FactoryGetWithRangeDescription(
const std::string& name,
Sample minimum,
Sample maximum,
@@ -713,7 +709,7 @@ HistogramBase* LinearHistogram::DeserializeInfoImpl(PickleIterator* iter) {
// This section provides implementation for BooleanHistogram.
//------------------------------------------------------------------------------
-Histogram* BooleanHistogram::FactoryGet(const string& name, int32 flags) {
+HistogramBase* BooleanHistogram::FactoryGet(const string& name, int32 flags) {
Histogram* histogram = StatisticsRecorder::FindHistogram(name);
if (!histogram) {
// To avoid racy destruction at shutdown, the following will be leaked.
@@ -741,10 +737,6 @@ HistogramType BooleanHistogram::GetHistogramType() const {
return BOOLEAN_HISTOGRAM;
}
-void BooleanHistogram::AddBoolean(bool value) {
- Add(value ? 1 : 0);
-}
-
BooleanHistogram::BooleanHistogram(const string& name,
const BucketRanges* ranges)
: LinearHistogram(name, 1, 2, 3, ranges) {}
@@ -775,9 +767,9 @@ HistogramBase* BooleanHistogram::DeserializeInfoImpl(PickleIterator* iter) {
// CustomHistogram:
//------------------------------------------------------------------------------
-Histogram* CustomHistogram::FactoryGet(const string& name,
- const vector<Sample>& custom_ranges,
- int32 flags) {
+HistogramBase* CustomHistogram::FactoryGet(const string& name,
+ const vector<Sample>& custom_ranges,
+ int32 flags) {
CHECK(ValidateCustomRanges(custom_ranges));
Histogram* histogram = StatisticsRecorder::FindHistogram(name);
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 2c832fd..47db608 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -147,8 +147,9 @@ class Lock;
histogram_factory_get_invocation) \
do { \
static base::subtle::AtomicWord atomic_histogram_pointer = 0; \
- base::Histogram* histogram_pointer(reinterpret_cast<base::Histogram*>( \
- base::subtle::Acquire_Load(&atomic_histogram_pointer))); \
+ base::HistogramBase* histogram_pointer( \
+ reinterpret_cast<base::HistogramBase*>( \
+ base::subtle::Acquire_Load(&atomic_histogram_pointer))); \
if (!histogram_pointer) { \
histogram_pointer = histogram_factory_get_invocation; \
base::subtle::Release_Store(&atomic_histogram_pointer, \
@@ -309,7 +310,7 @@ class Lock;
#define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, AddTime(sample), \
base::Histogram::FactoryTimeGet(name, min, max, bucket_count, \
- base::Histogram::kUmaTargetedHistogramFlag))
+ base::HistogramBase::kUmaTargetedHistogramFlag))
#define UMA_HISTOGRAM_COUNTS(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
name, sample, 1, 1000000, 50)
@@ -323,7 +324,7 @@ class Lock;
#define UMA_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::Histogram::FactoryGet(name, min, max, bucket_count, \
- base::Histogram::kUmaTargetedHistogramFlag))
+ base::HistogramBase::kUmaTargetedHistogramFlag))
#define UMA_HISTOGRAM_MEMORY_KB(name, sample) UMA_HISTOGRAM_CUSTOM_COUNTS( \
name, sample, 1000, 500000, 50)
@@ -337,19 +338,19 @@ class Lock;
#define UMA_HISTOGRAM_BOOLEAN(name, sample) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \
base::BooleanHistogram::FactoryGet(name, \
- base::Histogram::kUmaTargetedHistogramFlag))
+ base::HistogramBase::kUmaTargetedHistogramFlag))
// The samples should always be strictly less than |boundary_value|. For more
// details, see the comment for the |HISTOGRAM_ENUMERATION| macro, above.
#define UMA_HISTOGRAM_ENUMERATION(name, sample, boundary_value) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::LinearHistogram::FactoryGet(name, 1, boundary_value, \
- boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag))
+ boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag))
#define UMA_HISTOGRAM_CUSTOM_ENUMERATION(name, sample, custom_ranges) \
STATIC_HISTOGRAM_POINTER_BLOCK(name, Add(sample), \
base::CustomHistogram::FactoryGet(name, custom_ranges, \
- base::Histogram::kUmaTargetedHistogramFlag))
+ base::HistogramBase::kUmaTargetedHistogramFlag))
//------------------------------------------------------------------------------
@@ -388,16 +389,16 @@ class BASE_EXPORT Histogram : public HistogramBase {
// 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,
- size_t bucket_count,
- int32 flags);
- static Histogram* FactoryTimeGet(const std::string& name,
- base::TimeDelta minimum,
- base::TimeDelta maximum,
+ static HistogramBase* FactoryGet(const std::string& name,
+ Sample minimum,
+ Sample maximum,
size_t bucket_count,
int32 flags);
+ static HistogramBase* FactoryTimeGet(const std::string& name,
+ base::TimeDelta minimum,
+ base::TimeDelta maximum,
+ size_t bucket_count,
+ int32 flags);
// Time call for use with DHISTOGRAM*.
// Returns TimeTicks::Now() in debug and TimeTicks() in release build.
@@ -408,14 +409,6 @@ class BASE_EXPORT Histogram : public HistogramBase {
size_t bucket_count,
BucketRanges* ranges);
- // This method is an interface, used only by BooleanHistogram.
- virtual void AddBoolean(bool value);
-
- // Accept a TimeDelta to increment.
- void AddTime(TimeDelta time) {
- Add(static_cast<int>(time.InMilliseconds()));
- }
-
// This constant if for FindCorruption. Since snapshots of histograms are
// taken asynchronously relative to sampling, and our counting code currently
// does not prevent race conditions, it is pretty likely that we'll catch a
@@ -567,16 +560,16 @@ class BASE_EXPORT LinearHistogram : public Histogram {
/* minimum should start from 1. 0 is as minimum is invalid. 0 is an implicit
default underflow bucket. */
- static Histogram* FactoryGet(const std::string& name,
- Sample minimum,
- Sample maximum,
- size_t bucket_count,
- int32 flags);
- static Histogram* FactoryTimeGet(const std::string& name,
- TimeDelta minimum,
- TimeDelta maximum,
+ static HistogramBase* FactoryGet(const std::string& name,
+ Sample minimum,
+ Sample maximum,
size_t bucket_count,
int32 flags);
+ static HistogramBase* FactoryTimeGet(const std::string& name,
+ TimeDelta minimum,
+ TimeDelta maximum,
+ size_t bucket_count,
+ int32 flags);
struct DescriptionPair {
Sample sample;
@@ -588,7 +581,7 @@ class BASE_EXPORT LinearHistogram : public Histogram {
// |descriptions| can be NULL, which means no special descriptions to set. If
// it's not NULL, the last element in the array must has a NULL in its
// "description" field.
- static Histogram* FactoryGetWithRangeDescription(
+ static HistogramBase* FactoryGetWithRangeDescription(
const std::string& name,
Sample minimum,
Sample maximum,
@@ -640,12 +633,10 @@ class BASE_EXPORT LinearHistogram : public Histogram {
// BooleanHistogram is a histogram for booleans.
class BASE_EXPORT BooleanHistogram : public LinearHistogram {
public:
- static Histogram* FactoryGet(const std::string& name, int32 flags);
+ static HistogramBase* FactoryGet(const std::string& name, int32 flags);
virtual HistogramType GetHistogramType() const OVERRIDE;
- virtual void AddBoolean(bool value) OVERRIDE;
-
private:
BooleanHistogram(const std::string& name, const BucketRanges* ranges);
@@ -665,9 +656,9 @@ class BASE_EXPORT CustomHistogram : public Histogram {
// > 0 and < kSampleType_MAX. (Currently 0 is still accepted for backward
// compatibility). The limits can be unordered or contain duplication, but
// client should not depend on this.
- static Histogram* FactoryGet(const std::string& name,
- const std::vector<Sample>& custom_ranges,
- int32 flags);
+ static HistogramBase* FactoryGet(const std::string& name,
+ const std::vector<Sample>& custom_ranges,
+ int32 flags);
// Overridden from Histogram:
virtual HistogramType GetHistogramType() const OVERRIDE;
diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc
index 6396132..403303a 100644
--- a/base/metrics/histogram_base.cc
+++ b/base/metrics/histogram_base.cc
@@ -86,6 +86,14 @@ void HistogramBase::ClearFlags(int32 flags) {
flags_ &= ~flags;
}
+void HistogramBase::AddTime(const TimeDelta& time) {
+ Add(static_cast<Sample>(time.InMilliseconds()));
+}
+
+void HistogramBase::AddBoolean(bool value) {
+ Add(value ? 1 : 0);
+}
+
bool HistogramBase::SerializeInfo(Pickle* pickle) const {
if (!pickle->WriteInt(GetHistogramType()))
return false;
diff --git a/base/metrics/histogram_base.h b/base/metrics/histogram_base.h
index 949e864..729670c 100644
--- a/base/metrics/histogram_base.h
+++ b/base/metrics/histogram_base.h
@@ -10,6 +10,7 @@
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
class Pickle;
class PickleIterator;
@@ -90,6 +91,10 @@ class BASE_EXPORT HistogramBase {
virtual void Add(Sample value) = 0;
+ // 2 convenient functions that call Add(Sample).
+ void AddTime(const TimeDelta& time);
+ void AddBoolean(bool value);
+
virtual void AddSamples(const HistogramSamples& samples) = 0;
virtual bool AddSamplesFromPickle(PickleIterator* iter) = 0;
diff --git a/base/metrics/histogram_unittest.cc b/base/metrics/histogram_unittest.cc
index ee4e024..27c0faf 100644
--- a/base/metrics/histogram_unittest.cc
+++ b/base/metrics/histogram_unittest.cc
@@ -49,20 +49,20 @@ class HistogramTest : public testing::Test {
// Check for basic syntax and use.
TEST_F(HistogramTest, BasicTest) {
// Try basic construction
- Histogram* histogram(Histogram::FactoryGet(
- "TestHistogram", 1, 1000, 10, HistogramBase::kNoFlags));
- EXPECT_NE(reinterpret_cast<Histogram*>(NULL), histogram);
+ HistogramBase* histogram = Histogram::FactoryGet(
+ "TestHistogram", 1, 1000, 10, HistogramBase::kNoFlags);
+ EXPECT_TRUE(histogram);
- Histogram* linear_histogram(LinearHistogram::FactoryGet(
- "TestLinearHistogram", 1, 1000, 10, HistogramBase::kNoFlags));
- EXPECT_NE(reinterpret_cast<Histogram*>(NULL), linear_histogram);
+ HistogramBase* linear_histogram = LinearHistogram::FactoryGet(
+ "TestLinearHistogram", 1, 1000, 10, HistogramBase::kNoFlags);
+ EXPECT_TRUE(linear_histogram);
vector<int> custom_ranges;
custom_ranges.push_back(1);
custom_ranges.push_back(5);
- Histogram* custom_histogram(CustomHistogram::FactoryGet(
- "TestCustomHistogram", custom_ranges, HistogramBase::kNoFlags));
- EXPECT_NE(reinterpret_cast<Histogram*>(NULL), custom_histogram);
+ HistogramBase* custom_histogram = CustomHistogram::FactoryGet(
+ "TestCustomHistogram", custom_ranges, HistogramBase::kNoFlags);
+ EXPECT_TRUE(custom_histogram);
// Use standard macros (but with fixed samples)
HISTOGRAM_TIMES("Test2Histogram", TimeDelta::FromDays(1));
@@ -79,11 +79,12 @@ TEST_F(HistogramTest, BasicTest) {
TEST_F(HistogramTest, NameMatchTest) {
HISTOGRAM_PERCENTAGE("DuplicatedHistogram", 10);
HISTOGRAM_PERCENTAGE("DuplicatedHistogram", 10);
- Histogram* histogram(LinearHistogram::FactoryGet(
- "DuplicatedHistogram", 1, 101, 102, HistogramBase::kNoFlags));
- scoped_ptr<SampleVector> samples = histogram->SnapshotSampleVector();
+ HistogramBase* histogram = LinearHistogram::FactoryGet(
+ "DuplicatedHistogram", 1, 101, 102, HistogramBase::kNoFlags);
+
+ scoped_ptr<HistogramSamples> samples = histogram->SnapshotSamples();
EXPECT_EQ(2, samples->TotalCount());
- EXPECT_EQ(2, samples->GetCountAtIndex(10));
+ EXPECT_EQ(2, samples->GetCount(10));
}
TEST_F(HistogramTest, ExponentialRangesTest) {
@@ -99,8 +100,8 @@ TEST_F(HistogramTest, ExponentialRangesTest) {
EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges.range(8));
// Check the corresponding Histogram will use the correct ranges.
- Histogram* histogram(Histogram::FactoryGet(
- "Histogram", 1, 64, 8, HistogramBase::kNoFlags));
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
EXPECT_TRUE(ranges.Equals(histogram->bucket_ranges()));
// When bucket count is limited, exponential ranges will partially look like
@@ -126,8 +127,8 @@ TEST_F(HistogramTest, ExponentialRangesTest) {
EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges2.range(15));
// Check the corresponding Histogram will use the correct ranges.
- Histogram* histogram2(Histogram::FactoryGet(
- "Histogram2", 1, 32, 15, HistogramBase::kNoFlags));
+ Histogram* histogram2 = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram2", 1, 32, 15, HistogramBase::kNoFlags));
EXPECT_TRUE(ranges2.Equals(histogram2->bucket_ranges()));
}
@@ -138,8 +139,9 @@ TEST_F(HistogramTest, LinearRangesTest) {
for (int i = 0; i < 8; i++)
EXPECT_EQ(i, ranges.range(i));
EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges.range(8));
+
// The correspoding LinearHistogram should use the correct ranges.
- Histogram* histogram(
+ Histogram* histogram = static_cast<Histogram*>(
LinearHistogram::FactoryGet("Linear", 1, 7, 8, HistogramBase::kNoFlags));
EXPECT_TRUE(ranges.Equals(histogram->bucket_ranges()));
@@ -153,7 +155,7 @@ TEST_F(HistogramTest, LinearRangesTest) {
EXPECT_EQ(6, ranges2.range(4));
EXPECT_EQ(HistogramBase::kSampleType_MAX, ranges2.range(5));
// The correspoding LinearHistogram should use the correct ranges.
- Histogram* histogram2(
+ Histogram* histogram2 = static_cast<Histogram*>(
LinearHistogram::FactoryGet("Linear2", 1, 6, 5, HistogramBase::kNoFlags));
EXPECT_TRUE(ranges2.Equals(histogram2->bucket_ranges()));
}
@@ -176,8 +178,10 @@ TEST_F(HistogramTest, CustomHistogramTest) {
vector<HistogramBase::Sample> custom_ranges;
custom_ranges.push_back(1);
custom_ranges.push_back(2);
- Histogram* histogram = CustomHistogram::FactoryGet(
- "TestCustomHistogram1", custom_ranges, HistogramBase::kNoFlags);
+
+ Histogram* histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet("TestCustomHistogram1", custom_ranges,
+ HistogramBase::kNoFlags));
const BucketRanges* ranges = histogram->bucket_ranges();
ASSERT_EQ(4u, ranges->size());
EXPECT_EQ(0, ranges->range(0)); // Auto added.
@@ -189,8 +193,9 @@ TEST_F(HistogramTest, CustomHistogramTest) {
custom_ranges.clear();
custom_ranges.push_back(2);
custom_ranges.push_back(1);
- histogram = CustomHistogram::FactoryGet(
- "TestCustomHistogram2", custom_ranges, HistogramBase::kNoFlags);
+ histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet("TestCustomHistogram2", custom_ranges,
+ HistogramBase::kNoFlags));
ranges = histogram->bucket_ranges();
ASSERT_EQ(4u, ranges->size());
EXPECT_EQ(0, ranges->range(0));
@@ -203,8 +208,9 @@ TEST_F(HistogramTest, CustomHistogramTest) {
custom_ranges.push_back(4);
custom_ranges.push_back(1);
custom_ranges.push_back(4);
- histogram = CustomHistogram::FactoryGet(
- "TestCustomHistogram3", custom_ranges, HistogramBase::kNoFlags);
+ histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet("TestCustomHistogram3", custom_ranges,
+ HistogramBase::kNoFlags));
ranges = histogram->bucket_ranges();
ASSERT_EQ(4u, ranges->size());
EXPECT_EQ(0, ranges->range(0));
@@ -222,8 +228,9 @@ TEST_F(HistogramTest, CustomHistogramWithOnly2Buckets) {
vector<HistogramBase::Sample> custom_ranges;
custom_ranges.push_back(4);
- Histogram* histogram = CustomHistogram::FactoryGet(
- "2BucketsCustomHistogram", custom_ranges, HistogramBase::kNoFlags);
+ Histogram* histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet("2BucketsCustomHistogram", custom_ranges,
+ HistogramBase::kNoFlags));
const BucketRanges* ranges = histogram->bucket_ranges();
ASSERT_EQ(3u, ranges->size());
EXPECT_EQ(0, ranges->range(0));
@@ -234,8 +241,9 @@ TEST_F(HistogramTest, CustomHistogramWithOnly2Buckets) {
// Make sure histogram handles out-of-bounds data gracefully.
TEST_F(HistogramTest, BoundsTest) {
const size_t kBucketCount = 50;
- Histogram* histogram(Histogram::FactoryGet(
- "Bounded", 10, 100, kBucketCount, HistogramBase::kNoFlags));
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Bounded", 10, 100, kBucketCount,
+ HistogramBase::kNoFlags));
// Put two samples "out of bounds" above and below.
histogram->Add(5);
@@ -257,9 +265,9 @@ TEST_F(HistogramTest, BoundsTest) {
custom_ranges.push_back(10);
custom_ranges.push_back(50);
custom_ranges.push_back(100);
- Histogram* test_custom_histogram = CustomHistogram::FactoryGet(
- "TestCustomRangeBoundedHistogram", custom_ranges,
- HistogramBase::kNoFlags);
+ Histogram* test_custom_histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet("TestCustomRangeBoundedHistogram",
+ custom_ranges, HistogramBase::kNoFlags));
// Put two samples "out of bounds" above and below.
test_custom_histogram->Add(5);
@@ -280,8 +288,8 @@ TEST_F(HistogramTest, BoundsTest) {
// Check to be sure samples land as expected is "correct" buckets.
TEST_F(HistogramTest, BucketPlacementTest) {
- Histogram* histogram(Histogram::FactoryGet(
- "Histogram", 1, 64, 8, HistogramBase::kNoFlags));
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
// Add i+1 samples to the i'th bucket.
histogram->Add(0);
@@ -299,8 +307,8 @@ TEST_F(HistogramTest, BucketPlacementTest) {
}
TEST_F(HistogramTest, CorruptSampleCounts) {
- Histogram* histogram(Histogram::FactoryGet(
- "Histogram", 1, 64, 8, HistogramBase::kNoFlags)); // As per header file.
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
// Add some samples.
histogram->Add(20);
@@ -326,8 +334,8 @@ TEST_F(HistogramTest, CorruptSampleCounts) {
}
TEST_F(HistogramTest, CorruptBucketBounds) {
- Histogram* histogram(Histogram::FactoryGet(
- "Histogram", 1, 64, 8, HistogramBase::kNoFlags)); // As per header file.
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags));
scoped_ptr<SampleVector> snapshot = histogram->SnapshotSampleVector();
EXPECT_EQ(Histogram::NO_INCONSISTENCIES,
@@ -360,9 +368,9 @@ TEST_F(HistogramTest, CorruptBucketBounds) {
}
TEST_F(HistogramTest, HistogramSerializeInfo) {
- Histogram* histogram = Histogram::FactoryGet(
- "Histogram", 1, 64, 8, HistogramBase::kIPCSerializationSourceFlag);
-
+ Histogram* histogram = static_cast<Histogram*>(
+ Histogram::FactoryGet("Histogram", 1, 64, 8,
+ HistogramBase::kIPCSerializationSourceFlag));
Pickle pickle;
histogram->SerializeInfo(&pickle);
@@ -405,7 +413,7 @@ TEST_F(HistogramTest, CustomHistogramSerializeInfo) {
custom_ranges.push_back(10);
custom_ranges.push_back(100);
- Histogram* custom_histogram = CustomHistogram::FactoryGet(
+ HistogramBase* custom_histogram = CustomHistogram::FactoryGet(
"TestCustomRangeBoundedHistogram",
custom_ranges,
HistogramBase::kNoFlags);
@@ -440,25 +448,27 @@ TEST_F(HistogramTest, CustomHistogramSerializeInfo) {
// 1). But we accept ranges exceeding those limits, and silently clamped to
// those limits. This is for backwards compatibility.
TEST(HistogramDeathTest, BadRangesTest) {
- Histogram* histogram = Histogram::FactoryGet(
+ HistogramBase* histogram = Histogram::FactoryGet(
"BadRanges", 0, HistogramBase::kSampleType_MAX, 8,
HistogramBase::kNoFlags);
- EXPECT_EQ(1, histogram->declared_min());
- EXPECT_EQ(HistogramBase::kSampleType_MAX - 1, histogram->declared_max());
+ EXPECT_TRUE(
+ histogram->HasConstructionArguments(
+ 1, HistogramBase::kSampleType_MAX - 1, 8));
- Histogram* linear_histogram = LinearHistogram::FactoryGet(
+ HistogramBase* linear_histogram = LinearHistogram::FactoryGet(
"BadRangesLinear", 0, HistogramBase::kSampleType_MAX, 8,
HistogramBase::kNoFlags);
- EXPECT_EQ(1, linear_histogram->declared_min());
- EXPECT_EQ(HistogramBase::kSampleType_MAX - 1,
- linear_histogram->declared_max());
+ EXPECT_TRUE(
+ linear_histogram->HasConstructionArguments(
+ 1, HistogramBase::kSampleType_MAX - 1, 8));
vector<int> custom_ranges;
custom_ranges.push_back(0);
custom_ranges.push_back(5);
- Histogram* custom_histogram1 = CustomHistogram::FactoryGet(
- "BadRangesCustom", custom_ranges, HistogramBase::kNoFlags);
- const BucketRanges* ranges = custom_histogram1->bucket_ranges();
+ Histogram* custom_histogram = static_cast<Histogram*>(
+ CustomHistogram::FactoryGet(
+ "BadRangesCustom", custom_ranges, HistogramBase::kNoFlags));
+ const BucketRanges* ranges = custom_histogram->bucket_ranges();
ASSERT_EQ(3u, ranges->size());
EXPECT_EQ(0, ranges->range(0));
EXPECT_EQ(5, ranges->range(1));
diff --git a/base/metrics/statistics_recorder_unittest.cc b/base/metrics/statistics_recorder_unittest.cc
index 95759c1..0779c99 100644
--- a/base/metrics/statistics_recorder_unittest.cc
+++ b/base/metrics/statistics_recorder_unittest.cc
@@ -32,7 +32,14 @@ class StatisticsRecorderTest : public testing::Test {
statistics_recorder_ = NULL;
}
- void DeleteHistogram(Histogram* histogram) {
+ Histogram* CreateHistogram(const std::string& name,
+ HistogramBase::Sample min,
+ HistogramBase::Sample max,
+ size_t bucket_count) {
+ return new Histogram(name, min, max, bucket_count, NULL);
+ }
+
+ void DeleteHistogram(HistogramBase* histogram) {
delete histogram;
}
@@ -47,14 +54,17 @@ TEST_F(StatisticsRecorderTest, NotInitialized) {
StatisticsRecorder::Histograms registered_histograms;
std::vector<const BucketRanges*> registered_ranges;
- // We can still create histograms, but it's not registered.
- // TODO(kaiwang): Do not depend on Histogram FactoryGet implementation.
- Histogram* histogram(
- Histogram::FactoryGet("StatisticsRecorderTest_NotInitialized",
- 1, 1000, 10, Histogram::kNoFlags));
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(0u, registered_histograms.size());
+ Histogram* histogram = CreateHistogram("TestHistogram", 1, 1000, 10);
+
+ // When StatisticsRecorder is not initialized, register is a noop.
+ EXPECT_EQ(histogram,
+ StatisticsRecorder::RegisterOrDeleteDuplicate(histogram));
+ // Manually delete histogram that was not registered.
+ DeleteHistogram(histogram);
+
// RegisterOrDeleteDuplicateRanges is a no-op.
BucketRanges* ranges = new BucketRanges(3);;
ranges->ResetChecksum();
@@ -62,8 +72,6 @@ TEST_F(StatisticsRecorderTest, NotInitialized) {
StatisticsRecorder::RegisterOrDeleteDuplicateRanges(ranges));
StatisticsRecorder::GetBucketRanges(&registered_ranges);
EXPECT_EQ(0u, registered_ranges.size());
-
- DeleteHistogram(histogram);
}
TEST_F(StatisticsRecorderTest, RegisterBucketRanges) {
@@ -106,13 +114,8 @@ TEST_F(StatisticsRecorderTest, RegisterBucketRanges) {
TEST_F(StatisticsRecorderTest, RegisterHistogram) {
// Create a Histogram that was not registered.
- // TODO(kaiwang): Do not depend on Histogram FactoryGet implementation.
- UninitializeStatisticsRecorder();
- Histogram* histogram = Histogram::FactoryGet(
- "TestHistogram", 1, 1000, 10, Histogram::kNoFlags);
+ Histogram* histogram = CreateHistogram("TestHistogram", 1, 1000, 10);
- // Clean StatisticsRecorder.
- InitializeStatisticsRecorder();
StatisticsRecorder::Histograms registered_histograms;
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(0u, registered_histograms.size());
@@ -129,13 +132,15 @@ TEST_F(StatisticsRecorderTest, RegisterHistogram) {
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(1u, registered_histograms.size());
+
+ DeleteHistogram(histogram);
}
TEST_F(StatisticsRecorderTest, FindHistogram) {
- Histogram* histogram1 = Histogram::FactoryGet(
- "TestHistogram1", 1, 1000, 10, Histogram::kNoFlags);
- Histogram* histogram2 = Histogram::FactoryGet(
- "TestHistogram2", 1, 1000, 10, Histogram::kNoFlags);
+ HistogramBase* histogram1 = Histogram::FactoryGet(
+ "TestHistogram1", 1, 1000, 10, HistogramBase::kNoFlags);
+ HistogramBase* histogram2 = Histogram::FactoryGet(
+ "TestHistogram2", 1, 1000, 10, HistogramBase::kNoFlags);
EXPECT_EQ(histogram1, StatisticsRecorder::FindHistogram("TestHistogram1"));
EXPECT_EQ(histogram2, StatisticsRecorder::FindHistogram("TestHistogram2"));
@@ -166,16 +171,16 @@ TEST_F(StatisticsRecorderTest, RegisterHistogramWithFactoryGet) {
StatisticsRecorder::GetHistograms(&registered_histograms);
ASSERT_EQ(0u, registered_histograms.size());
- // Create a Histogram.
- Histogram* histogram = Histogram::FactoryGet(
- "TestHistogram", 1, 1000, 10, Histogram::kNoFlags);
+ // Create a histogram.
+ HistogramBase* histogram = Histogram::FactoryGet(
+ "TestHistogram", 1, 1000, 10, HistogramBase::kNoFlags);
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(1u, registered_histograms.size());
// Get an existing histogram.
- Histogram* histogram2 = Histogram::FactoryGet(
- "TestHistogram", 1, 1000, 10, Histogram::kNoFlags);
+ HistogramBase* histogram2 = Histogram::FactoryGet(
+ "TestHistogram", 1, 1000, 10, HistogramBase::kNoFlags);
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(1u, registered_histograms.size());
@@ -183,14 +188,14 @@ TEST_F(StatisticsRecorderTest, RegisterHistogramWithFactoryGet) {
// Create a LinearHistogram.
histogram = LinearHistogram::FactoryGet(
- "TestLinearHistogram", 1, 1000, 10, Histogram::kNoFlags);
+ "TestLinearHistogram", 1, 1000, 10, HistogramBase::kNoFlags);
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(2u, registered_histograms.size());
// Create a BooleanHistogram.
histogram = BooleanHistogram::FactoryGet(
- "TestBooleanHistogram", Histogram::kNoFlags);
+ "TestBooleanHistogram", HistogramBase::kNoFlags);
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(3u, registered_histograms.size());
@@ -200,7 +205,7 @@ TEST_F(StatisticsRecorderTest, RegisterHistogramWithFactoryGet) {
custom_ranges.push_back(1);
custom_ranges.push_back(5);
histogram = CustomHistogram::FactoryGet(
- "TestCustomHistogram", custom_ranges, Histogram::kNoFlags);
+ "TestCustomHistogram", custom_ranges, HistogramBase::kNoFlags);
registered_histograms.clear();
StatisticsRecorder::GetHistograms(&registered_histograms);
EXPECT_EQ(4u, registered_histograms.size());
@@ -209,8 +214,8 @@ TEST_F(StatisticsRecorderTest, RegisterHistogramWithFactoryGet) {
TEST_F(StatisticsRecorderTest, RegisterHistogramWithMacros) {
StatisticsRecorder::Histograms registered_histograms;
- Histogram* histogram = Histogram::FactoryGet(
- "TestHistogramCounts", 1, 1000000, 50, Histogram::kNoFlags);
+ HistogramBase* histogram = Histogram::FactoryGet(
+ "TestHistogramCounts", 1, 1000000, 50, HistogramBase::kNoFlags);
// The histogram we got from macro is the same as from FactoryGet.
HISTOGRAM_COUNTS("TestHistogramCounts", 30);
@@ -239,18 +244,21 @@ TEST_F(StatisticsRecorderTest, RegisterHistogramWithMacros) {
}
TEST_F(StatisticsRecorderTest, BucketRangesSharing) {
- Histogram* histogram1(Histogram::FactoryGet(
- "Histogram", 1, 64, 8, Histogram::kNoFlags));
- Histogram* histogram2(Histogram::FactoryGet(
- "Histogram2", 1, 64, 8, Histogram::kNoFlags));
- Histogram* histogram3(Histogram::FactoryGet(
- "Histogram3", 1, 64, 16, Histogram::kNoFlags));
-
- const BucketRanges* bucket_ranges1 = histogram1->bucket_ranges();
- const BucketRanges* bucket_ranges2 = histogram2->bucket_ranges();
- const BucketRanges* bucket_ranges3 = histogram3->bucket_ranges();
- EXPECT_EQ(bucket_ranges1, bucket_ranges2);
- EXPECT_FALSE(bucket_ranges1->Equals(bucket_ranges3));
+ std::vector<const BucketRanges*> ranges;
+ StatisticsRecorder::GetBucketRanges(&ranges);
+ EXPECT_EQ(0u, ranges.size());
+
+ Histogram::FactoryGet("Histogram", 1, 64, 8, HistogramBase::kNoFlags);
+ Histogram::FactoryGet("Histogram2", 1, 64, 8, HistogramBase::kNoFlags);
+
+ StatisticsRecorder::GetBucketRanges(&ranges);
+ EXPECT_EQ(1u, ranges.size());
+
+ Histogram::FactoryGet("Histogram3", 1, 64, 16, HistogramBase::kNoFlags);
+
+ ranges.clear();
+ StatisticsRecorder::GetBucketRanges(&ranges);
+ EXPECT_EQ(2u, ranges.size());
}
} // namespace base
diff --git a/chrome/browser/autocomplete/autocomplete_controller.cc b/chrome/browser/autocomplete/autocomplete_controller.cc
index f0c63ef..fd59b7e 100644
--- a/chrome/browser/autocomplete/autocomplete_controller.cc
+++ b/chrome/browser/autocomplete/autocomplete_controller.cc
@@ -201,7 +201,7 @@ void AutocompleteController::Start(const AutocompleteInput& input) {
base::TimeTicks end_time = base::TimeTicks::Now();
std::string name = "Omnibox.QueryTime." + base::IntToString(
input.text().length());
- base::Histogram* counter = base::Histogram::FactoryGet(
+ base::HistogramBase* counter = base::Histogram::FactoryGet(
name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
}
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc
index 2fda350..4b0dce3 100644
--- a/chrome/browser/autocomplete/history_quick_provider.cc
+++ b/chrome/browser/autocomplete/history_quick_provider.cc
@@ -143,7 +143,7 @@ void HistoryQuickProvider::Start(const AutocompleteInput& input,
base::TimeTicks end_time = base::TimeTicks::Now();
std::string name = "HistoryQuickProvider.QueryIndexTime." +
base::IntToString(input.text().length());
- base::Histogram* counter = base::Histogram::FactoryGet(
+ base::HistogramBase* counter = base::Histogram::FactoryGet(
name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
}
diff --git a/chrome/browser/autocomplete/shortcuts_provider.cc b/chrome/browser/autocomplete/shortcuts_provider.cc
index 322ecb2..9333a18 100644
--- a/chrome/browser/autocomplete/shortcuts_provider.cc
+++ b/chrome/browser/autocomplete/shortcuts_provider.cc
@@ -87,7 +87,7 @@ void ShortcutsProvider::Start(const AutocompleteInput& input,
base::TimeTicks end_time = base::TimeTicks::Now();
std::string name = "ShortcutsProvider.QueryIndexTime." +
base::IntToString(input.text().size());
- base::Histogram* counter = base::Histogram::FactoryGet(
+ base::HistogramBase* counter = base::Histogram::FactoryGet(
name, 1, 1000, 50, base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(static_cast<int>((end_time - start_time).InMilliseconds()));
}
diff --git a/chrome/browser/autofill/autofill_metrics.cc b/chrome/browser/autofill/autofill_metrics.cc
index 24c9e70..94f3cff 100644
--- a/chrome/browser/autofill/autofill_metrics.cc
+++ b/chrome/browser/autofill/autofill_metrics.cc
@@ -163,13 +163,13 @@ void LogUMAHistogramEnumeration(const std::string& name,
// We can't use the UMA_HISTOGRAM_ENUMERATION macro here because the histogram
// name can vary over the duration of the program.
// Note that this leaks memory; that is expected behavior.
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::LinearHistogram::FactoryGet(
name,
1,
boundary_value,
boundary_value + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->Add(sample);
}
diff --git a/chrome/browser/captive_portal/captive_portal_service.cc b/chrome/browser/captive_portal/captive_portal_service.cc
index e31575e..32e1a80 100644
--- a/chrome/browser/captive_portal/captive_portal_service.cc
+++ b/chrome/browser/captive_portal/captive_portal_service.cc
@@ -44,7 +44,7 @@ void RecordRepeatHistograms(Result result,
// pointers, so have to use the histogram functions directly.
// Record number of times the last result was received in a row.
- base::Histogram* result_repeated_histogram =
+ base::HistogramBase* result_repeated_histogram =
base::Histogram::FactoryGet(
"CaptivePortal.ResultRepeated." +
CaptivePortalDetector::CaptivePortalResultToString(result),
@@ -58,7 +58,7 @@ void RecordRepeatHistograms(Result result,
return;
// Time between first request that returned |result| and now.
- base::Histogram* result_duration_histogram =
+ base::HistogramBase* result_duration_histogram =
base::Histogram::FactoryTimeGet(
"CaptivePortal.ResultDuration." +
CaptivePortalDetector::CaptivePortalResultToString(result),
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 558380f..76ba381 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -386,7 +386,7 @@ void AddPreReadHistogramTime(const char* name, base::TimeDelta time) {
// FactoryTimeGet will always return a pointer to the same histogram object,
// keyed on its name. There's no need for us to store it explicitly anywhere.
- base::Histogram* counter = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* counter = base::Histogram::FactoryTimeGet(
name, kMin, kMax, kBuckets, base::Histogram::kUmaTargetedHistogramFlag);
counter->AddTime(time);
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index f1038beb..24f7bcf 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -328,12 +328,12 @@ void BootTimesLoader::WriteTimes(
base::Time first = login_times.front().time();
base::Time last = login_times.back().time();
base::TimeDelta total = last - first;
- base::Histogram* total_hist = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* total_hist = base::Histogram::FactoryTimeGet(
uma_name,
base::TimeDelta::FromMilliseconds(kMinTimeMillis),
base::TimeDelta::FromMilliseconds(kMaxTimeMillis),
kNumBuckets,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
total_hist->AddTime(total);
std::string output =
base::StringPrintf("%s: %.2f", uma_name.c_str(), total.InSecondsF());
@@ -346,12 +346,12 @@ void BootTimesLoader::WriteTimes(
if (tm.send_to_uma()) {
name = uma_prefix + tm.name();
- base::Histogram* prev_hist = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* prev_hist = base::Histogram::FactoryTimeGet(
name,
base::TimeDelta::FromMilliseconds(kMinTimeMillis),
base::TimeDelta::FromMilliseconds(kMaxTimeMillis),
kNumBuckets,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
prev_hist->AddTime(since_prev);
} else {
name = tm.name();
diff --git a/chrome/browser/chromeos/external_metrics.cc b/chrome/browser/chromeos/external_metrics.cc
index 1c8ac7a..71edb3b 100644
--- a/chrome/browser/chromeos/external_metrics.cc
+++ b/chrome/browser/chromeos/external_metrics.cc
@@ -122,7 +122,7 @@ void ExternalMetrics::RecordHistogram(const char* histogram_data) {
}
// Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram
// instance and thus only work if |name| is constant.
- base::Histogram* counter = base::Histogram::FactoryGet(
+ base::HistogramBase* counter = base::Histogram::FactoryGet(
name, min, max, nbuckets, base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(sample);
}
@@ -143,7 +143,7 @@ void ExternalMetrics::RecordLinearHistogram(const char* histogram_data) {
}
// Do not use the UMA_HISTOGRAM_... macros here. They cache the Histogram
// instance and thus only work if |name| is constant.
- base::Histogram* counter = base::LinearHistogram::FactoryGet(
+ base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
name, 1, max, max + 1, base::Histogram::kUmaTargetedHistogramFlag);
counter->Add(sample);
}
diff --git a/chrome/browser/chromeos/login/user_image_manager_impl.cc b/chrome/browser/chromeos/login/user_image_manager_impl.cc
index 65feddf..0bd9eb1 100644
--- a/chrome/browser/chromeos/login/user_image_manager_impl.cc
+++ b/chrome/browser/chromeos/login/user_image_manager_impl.cc
@@ -129,9 +129,9 @@ void AddProfileImageTimeHistogram(ProfileDownloadResult result,
static const base::TimeDelta max_time = base::TimeDelta::FromSeconds(50);
const size_t bucket_count(50);
- base::Histogram* counter = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* counter = base::Histogram::FactoryTimeGet(
histogram_name, min_time, max_time, bucket_count,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->AddTime(time_delta);
DVLOG(1) << "Profile image download time: " << time_delta.InSecondsF();
diff --git a/chrome/browser/extensions/api/metrics/metrics.cc b/chrome/browser/extensions/api/metrics/metrics.cc
index 2ff421c..454906b 100644
--- a/chrome/browser/extensions/api/metrics/metrics.cc
+++ b/chrome/browser/extensions/api/metrics/metrics.cc
@@ -52,7 +52,7 @@ bool MetricsHistogramHelperFunction::RecordValue(
if (buckets > static_cast<size_t>(max - min + 2))
buckets = max - min + 2;
- base::Histogram* counter;
+ base::HistogramBase* counter;
if (type == base::LINEAR_HISTOGRAM) {
counter = base::LinearHistogram::FactoryGet(
name, min, max, buckets,
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index a69054e..422430f 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -1000,14 +1000,14 @@ void ExtensionService::GrantPermissions(const Extension* extension,
// static
void ExtensionService::RecordPermissionMessagesHistogram(
const Extension* e, const char* histogram) {
- // Since this is called from multiple sources, and since the Histogram macros
- // use statics, we need to manually lookup the Histogram ourselves.
- base::Histogram* counter = base::LinearHistogram::FactoryGet(
+ // Since this is called from multiple sources, and since the histogram macros
+ // use statics, we need to manually lookup the histogram ourselves.
+ base::HistogramBase* counter = base::LinearHistogram::FactoryGet(
histogram,
1,
PermissionMessage::kEnumBoundary,
PermissionMessage::kEnumBoundary + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
PermissionMessages permissions = e->GetPermissionMessages();
if (permissions.empty()) {
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index acb9583..6314a47 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -65,10 +65,10 @@ void RecordEventHistogram(InstantControllerEvent event) {
void AddSessionStorageHistogram(bool extended_enabled,
const content::WebContents* tab1,
const content::WebContents* tab2) {
- base::Histogram* histogram = base::BooleanHistogram::FactoryGet(
+ base::HistogramBase* histogram = base::BooleanHistogram::FactoryGet(
std::string("Instant.SessionStorageNamespace") +
(extended_enabled ? "_Extended" : "_Instant"),
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
const content::SessionStorageNamespaceMap& session_storage_map1 =
tab1->GetController().GetSessionStorageNamespaceMap();
const content::SessionStorageNamespaceMap& session_storage_map2 =
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index e362098..c252ab6 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -117,8 +117,8 @@ class JankObserverHelper {
// Counters for the two types of jank we measure.
base::StatsCounter slow_processing_counter_; // Msgs w/ long proc time.
base::StatsCounter queueing_delay_counter_; // Msgs w/ long queueing delay.
- base::Histogram* const process_times_; // Time spent proc. task.
- base::Histogram* const total_times_; // Total queueing plus proc.
+ base::HistogramBase* const process_times_; // Time spent proc. task.
+ base::HistogramBase* const total_times_; // Total queueing plus proc.
JankWatchdog total_time_watchdog_; // Watching for excessive total_time.
DISALLOW_COPY_AND_ASSIGN(JankObserverHelper);
diff --git a/chrome/browser/metrics/thread_watcher.h b/chrome/browser/metrics/thread_watcher.h
index 0ea8b37..c9f824b 100644
--- a/chrome/browser/metrics/thread_watcher.h
+++ b/chrome/browser/metrics/thread_watcher.h
@@ -250,20 +250,20 @@ class ThreadWatcher {
int ping_count_;
// Histogram that keeps track of response times for the watched thread.
- base::Histogram* response_time_histogram_;
+ base::HistogramBase* response_time_histogram_;
// Histogram that keeps track of unresponsive time since the last pong message
// when we got no response (GotNoResponse()) from the watched thread.
- base::Histogram* unresponsive_time_histogram_;
+ base::HistogramBase* unresponsive_time_histogram_;
// Histogram that keeps track of how many threads are responding when we got
// no response (GotNoResponse()) from the watched thread.
- base::Histogram* responsive_count_histogram_;
+ base::HistogramBase* responsive_count_histogram_;
// Histogram that keeps track of how many threads are not responding when we
// got no response (GotNoResponse()) from the watched thread. Count includes
// the thread that got no response.
- base::Histogram* unresponsive_count_histogram_;
+ base::HistogramBase* unresponsive_count_histogram_;
// This counter tracks the unresponsiveness of watched thread. If this value
// is zero then watched thread has responded with a pong message. This is
diff --git a/chrome/browser/net/load_time_stats.cc b/chrome/browser/net/load_time_stats.cc
index b668b35..648e7a7 100644
--- a/chrome/browser/net/load_time_stats.cc
+++ b/chrome/browser/net/load_time_stats.cc
@@ -317,7 +317,7 @@ LoadTimeStats::LoadTimeStats() {
histograms_[status][histogram_type].push_back(
base::LinearHistogram::FactoryGet(
histogram_name,
- 0, 101, 51, base::Histogram::kUmaTargetedHistogramFlag));
+ 0, 101, 51, base::HistogramBase::kUmaTargetedHistogramFlag));
}
DCHECK_EQ(histograms_[status][histogram_type].size(),
arraysize(kStatsCollectionTimesMs));
diff --git a/chrome/browser/net/load_time_stats.h b/chrome/browser/net/load_time_stats.h
index f3ba65b..961a382 100644
--- a/chrome/browser/net/load_time_stats.h
+++ b/chrome/browser/net/load_time_stats.h
@@ -20,7 +20,7 @@
#include "net/base/network_delegate.h"
namespace base {
-class Histogram;
+class HistogramBase;
}
namespace net {
@@ -111,7 +111,8 @@ class LoadTimeStats {
TabLoadStatsMap tab_load_stats_;
RequestStatsMap request_stats_;
- std::vector<base::Histogram*> histograms_[REQUEST_STATUS_MAX][HISTOGRAM_MAX];
+ std::vector<base::HistogramBase*>
+ histograms_[REQUEST_STATUS_MAX][HISTOGRAM_MAX];
base::hash_set<const net::URLRequestContext*> main_request_contexts_;
DISALLOW_COPY_AND_ASSIGN(LoadTimeStats);
diff --git a/chrome/browser/net/network_stats.cc b/chrome/browser/net/network_stats.cc
index b70771b..46abe1c 100644
--- a/chrome/browser/net/network_stats.cc
+++ b/chrome/browser/net/network_stats.cc
@@ -554,7 +554,7 @@ NetworkStats::Status NetworkStats::VerifyPackets() {
kMaximumSequentialPackets,
kPorts[histogram_port_],
load_size_);
- base::Histogram* histogram = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* histogram = base::Histogram::FactoryTimeGet(
histogram_name, base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromSeconds(30), 50,
base::Histogram::kUmaTargetedHistogramFlag);
@@ -712,8 +712,9 @@ void NetworkStats::RecordAcksReceivedHistograms(
kMaximumSequentialPackets,
kPorts[histogram_port_],
load_size_string.c_str());
- base::Histogram* got_an_ack_histogram = base::BooleanHistogram::FactoryGet(
- histogram_name, base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase* got_an_ack_histogram =
+ base::BooleanHistogram::FactoryGet(
+ histogram_name, base::HistogramBase::kUmaTargetedHistogramFlag);
got_an_ack_histogram->AddBoolean(received_atleast_one_packet);
histogram_name = base::StringPrintf(
@@ -722,11 +723,11 @@ void NetworkStats::RecordAcksReceivedHistograms(
kMaximumSequentialPackets,
kPorts[histogram_port_],
load_size_string.c_str());
- base::Histogram* packets_sent_histogram =
+ base::HistogramBase* packets_sent_histogram =
base::Histogram::FactoryGet(
histogram_name,
1, kMaximumSequentialPackets, kMaximumSequentialPackets + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
packets_sent_histogram->Add(packets_sent_);
if (!received_atleast_one_packet || packets_sent_ != packets_to_send_)
@@ -738,11 +739,11 @@ void NetworkStats::RecordAcksReceivedHistograms(
kMaximumSequentialPackets,
kPorts[histogram_port_],
load_size_string.c_str());
- base::Histogram* ack_received_for_nth_packet_histogram =
+ base::HistogramBase* ack_received_for_nth_packet_histogram =
base::Histogram::FactoryGet(
histogram_name,
1, kMaximumSequentialPackets + 1, kMaximumSequentialPackets + 2,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
int count = 0;
for (size_t j = 0; j < packets_to_send_; j++) {
@@ -760,10 +761,10 @@ void NetworkStats::RecordAcksReceivedHistograms(
packet_number,
kPorts[histogram_port_],
load_size_string.c_str());
- base::Histogram* acks_received_count_histogram =
+ base::HistogramBase* acks_received_count_histogram =
base::Histogram::FactoryGet(
histogram_name, 1, packet_number, packet_number + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
acks_received_count_histogram->Add(count);
}
}
@@ -792,12 +793,13 @@ void NetworkStats::RecordPacketLossSeriesHistograms(
size_t histogram_count = has_proxy_server_ ? 1 : 2;
for (size_t i = 0; i < histogram_count; i++) {
// For packet loss test, just record packet loss data.
- base::Histogram* series_acked_histogram = base::LinearHistogram::FactoryGet(
- series_acked_histogram_name,
- 1,
- 1 << kCorrelatedLossPacketCount,
- (1 << kCorrelatedLossPacketCount) + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase* series_acked_histogram =
+ base::LinearHistogram::FactoryGet(
+ series_acked_histogram_name,
+ 1,
+ 1 << kCorrelatedLossPacketCount,
+ (1 << kCorrelatedLossPacketCount) + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
series_acked_histogram->Add(correlated_packet_mask);
series_acked_histogram_name.append(".NoProxy");
}
@@ -817,11 +819,11 @@ void NetworkStats::RecordRTTHistograms(const ProtocolValue& protocol,
index + 1,
kPorts[histogram_port_],
load_size_string.c_str());
- base::Histogram* rtt_histogram = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* rtt_histogram = base::Histogram::FactoryTimeGet(
rtt_histogram_name,
base::TimeDelta::FromMilliseconds(10),
base::TimeDelta::FromSeconds(30), 50,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
base::TimeDelta duration =
packet_status_[index].end_time_ - packet_status_[index].start_time_;
rtt_histogram->AddTime(duration);
diff --git a/chrome/browser/net/url_info.cc b/chrome/browser/net/url_info.cc
index a5ac9b2..ddba658 100644
--- a/chrome/browser/net/url_info.cc
+++ b/chrome/browser/net/url_info.cc
@@ -139,11 +139,11 @@ void UrlInfo::RemoveFromQueue() {
}
// Make a custom linear histogram for the region from 0 to boundary.
static const size_t kBucketCount = 52;
- static base::Histogram* histogram(NULL);
+ static base::HistogramBase* histogram(NULL);
if (!histogram)
histogram = base::LinearHistogram::FactoryTimeGet(
"DNS.QueueRecycledUnder2", TimeDelta(), kBoundary, kBucketCount,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->AddTime(queue_duration_);
}
diff --git a/chrome/browser/predictors/resource_prefetch_predictor.cc b/chrome/browser/predictors/resource_prefetch_predictor.cc
index 9d05933..098bd36 100644
--- a/chrome/browser/predictors/resource_prefetch_predictor.cc
+++ b/chrome/browser/predictors/resource_prefetch_predictor.cc
@@ -1118,7 +1118,7 @@ void ResourcePrefetchPredictor::ReportAccuracyStats(
{ \
std::string name = "ResourcePrefetchPredictor." + histogram_type + suffix; \
std::string g_name = "ResourcePrefetchPredictor." + std::string(suffix); \
- base::Histogram* histogram = base::LinearHistogram::FactoryGet( \
+ base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( \
name, 1, 101, 102, base::Histogram::kUmaTargetedHistogramFlag); \
histogram->Add(value); \
UMA_HISTOGRAM_PERCENTAGE(g_name, value); \
@@ -1202,7 +1202,7 @@ void ResourcePrefetchPredictor::ReportPredictedAccuracyStatsHelper(
#define RPP_PREDICTED_HISTOGRAM_COUNTS(name, value) \
{ \
std::string full_name = prefix + name + suffix; \
- base::Histogram* histogram = base::Histogram::FactoryGet( \
+ base::HistogramBase* histogram = base::Histogram::FactoryGet( \
full_name, 1, 1000000, 50, \
base::Histogram::kUmaTargetedHistogramFlag); \
histogram->Add(value); \
@@ -1211,7 +1211,7 @@ void ResourcePrefetchPredictor::ReportPredictedAccuracyStatsHelper(
#define RPP_PREDICTED_HISTOGRAM_PERCENTAGE(name, value) \
{ \
std::string full_name = prefix + name + suffix; \
- base::Histogram* histogram = base::LinearHistogram::FactoryGet( \
+ base::HistogramBase* histogram = base::LinearHistogram::FactoryGet( \
full_name, 1, 101, 102, base::Histogram::kUmaTargetedHistogramFlag); \
histogram->Add(value); \
}
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index cd91de2..a4d953f 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -358,7 +358,7 @@ void TabLoader::Observe(int type,
std::string time_for_count =
base::StringPrintf("SessionRestore.FirstTabPainted_%d",
tab_count_);
- base::Histogram* counter_for_count =
+ base::HistogramBase* counter_for_count =
base::Histogram::FactoryTimeGet(
time_for_count,
base::TimeDelta::FromMilliseconds(10),
@@ -463,7 +463,7 @@ void TabLoader::HandleTabClosedOrLoaded(NavigationController* tab) {
// Record a time for the number of tabs, to help track down contention.
std::string time_for_count =
base::StringPrintf("SessionRestore.AllTabsLoaded_%d", tab_count_);
- base::Histogram* counter_for_count =
+ base::HistogramBase* counter_for_count =
base::Histogram::FactoryTimeGet(
time_for_count,
base::TimeDelta::FromMilliseconds(10),
diff --git a/chrome/browser/signin/token_service.cc b/chrome/browser/signin/token_service.cc
index 5b8cc8a..0355c7b 100644
--- a/chrome/browser/signin/token_service.cc
+++ b/chrome/browser/signin/token_service.cc
@@ -307,13 +307,13 @@ void TokenService::FireTokenRequestFailedNotification(
// the metric name can be "TokenService.TokenRequestFailed." + one of four
// different values, we need to create the histogram ourselves and add the
// sample.
- base::Histogram* histogram =
+ base::HistogramBase* histogram =
base::LinearHistogram::FactoryGet(
metric,
1,
GoogleServiceAuthError::NUM_STATES,
GoogleServiceAuthError::NUM_STATES + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
histogram->Add(error.state());
#endif
diff --git a/chrome/browser/ui/webui/metrics_handler.cc b/chrome/browser/ui/webui/metrics_handler.cc
index b59c4c3..8789411 100644
--- a/chrome/browser/ui/webui/metrics_handler.cc
+++ b/chrome/browser/ui/webui/metrics_handler.cc
@@ -69,10 +69,10 @@ void MetricsHandler::HandleRecordInHistogram(const ListValue* args) {
// As |histogram_name| may change between calls, the UMA_HISTOGRAM_ENUMERATION
// macro cannot be used here.
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::LinearHistogram::FactoryGet(
histogram_name, 1, int_boundary_value, bucket_count + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->Add(int_value);
}
diff --git a/chrome/common/startup_metric_utils.cc b/chrome/common/startup_metric_utils.cc
index 887a2d2..75aa6fe 100644
--- a/chrome/common/startup_metric_utils.cc
+++ b/chrome/common/startup_metric_utils.cc
@@ -109,12 +109,12 @@ void OnBrowserStartupComplete() {
i != time_hash->end();
++i) {
const std::string histogram_name = i->first;
- base::Histogram* counter = base::Histogram::FactoryTimeGet(
+ base::HistogramBase* counter = base::Histogram::FactoryTimeGet(
histogram_name,
kStartupTimeMin,
kStartupTimeMax,
kStartupTimeBuckets,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->AddTime(i->second);
}
}
diff --git a/content/browser/gpu/gpu_util.cc b/content/browser/gpu/gpu_util.cc
index 5de32a8..b013cad 100644
--- a/content/browser/gpu/gpu_util.cc
+++ b/content/browser/gpu/gpu_util.cc
@@ -244,17 +244,17 @@ void UpdateStats(const GpuBlacklist* blacklist,
value = kGpuFeatureBlacklisted;
else if (kGpuFeatureUserFlags[i])
value = kGpuFeatureDisabled;
- base::Histogram* histogram_pointer = base::LinearHistogram::FactoryGet(
+ base::HistogramBase* histogram_pointer = base::LinearHistogram::FactoryGet(
kGpuBlacklistFeatureHistogramNames[i],
1, kGpuFeatureNumStatus, kGpuFeatureNumStatus + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
histogram_pointer->Add(value);
#if defined(OS_WIN)
histogram_pointer = base::LinearHistogram::FactoryGet(
kGpuBlacklistFeatureHistogramNamesWin[i],
1, kNumWinSubVersions * kGpuFeatureNumStatus,
kNumWinSubVersions * kGpuFeatureNumStatus + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
histogram_pointer->Add(GetGpuBlacklistHistogramValueWin(value));
#endif
}
diff --git a/content/browser/loader/buffered_resource_handler.cc b/content/browser/loader/buffered_resource_handler.cc
index 3a13709..c212eb9 100644
--- a/content/browser/loader/buffered_resource_handler.cc
+++ b/content/browser/loader/buffered_resource_handler.cc
@@ -37,24 +37,24 @@ namespace {
void RecordSnifferMetrics(bool sniffing_blocked,
bool we_would_like_to_sniff,
const std::string& mime_type) {
- static base::Histogram* nosniff_usage(NULL);
+ static base::HistogramBase* nosniff_usage(NULL);
if (!nosniff_usage)
nosniff_usage = base::BooleanHistogram::FactoryGet(
- "nosniff.usage", base::Histogram::kUmaTargetedHistogramFlag);
+ "nosniff.usage", base::HistogramBase::kUmaTargetedHistogramFlag);
nosniff_usage->AddBoolean(sniffing_blocked);
if (sniffing_blocked) {
- static base::Histogram* nosniff_otherwise(NULL);
+ static base::HistogramBase* nosniff_otherwise(NULL);
if (!nosniff_otherwise)
nosniff_otherwise = base::BooleanHistogram::FactoryGet(
- "nosniff.otherwise", base::Histogram::kUmaTargetedHistogramFlag);
+ "nosniff.otherwise", base::HistogramBase::kUmaTargetedHistogramFlag);
nosniff_otherwise->AddBoolean(we_would_like_to_sniff);
- static base::Histogram* nosniff_empty_mime_type(NULL);
+ static base::HistogramBase* nosniff_empty_mime_type(NULL);
if (!nosniff_empty_mime_type)
nosniff_empty_mime_type = base::BooleanHistogram::FactoryGet(
"nosniff.empty_mime_type",
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
nosniff_empty_mime_type->AddBoolean(mime_type.empty());
}
}
diff --git a/content/browser/zygote_host/zygote_host_impl_linux.cc b/content/browser/zygote_host/zygote_host_impl_linux.cc
index 87130aa..409a19f 100644
--- a/content/browser/zygote_host/zygote_host_impl_linux.cc
+++ b/content/browser/zygote_host/zygote_host_impl_linux.cc
@@ -311,12 +311,13 @@ pid_t ZygoteHostImpl::ForkRequest(
// Here we're using whatever name we got from the other side.
// But since it's likely that the same one will be used repeatedly
// (even though it's not guaranteed), we cache it here.
- static base::Histogram* uma_histogram;
+ static base::HistogramBase* uma_histogram;
if (!uma_histogram || uma_histogram->histogram_name() != uma_name) {
uma_histogram = base::LinearHistogram::FactoryGet(
uma_name, 1,
uma_boundary_value,
- uma_boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
+ uma_boundary_value + 1,
+ base::HistogramBase::kUmaTargetedHistogramFlag);
}
uma_histogram->Add(uma_sample);
}
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 5191082..af28945 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -188,7 +188,7 @@ void* CreateHistogram(
} else {
histogram_name = std::string(name);
}
- base::Histogram* histogram = base::Histogram::FactoryGet(
+ base::HistogramBase* histogram = base::Histogram::FactoryGet(
histogram_name, min, max, buckets,
base::Histogram::kUmaTargetedHistogramFlag);
return histogram;
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 58fc8f9..e8b6d29 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -610,13 +610,13 @@ void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event,
std::string name_for_event =
base::StringPrintf("Event.Latency.Renderer.%s",
GetEventName(input_event->type));
- base::Histogram* counter_for_type =
+ base::HistogramBase* counter_for_type =
base::Histogram::FactoryTimeGet(
name_for_event,
base::TimeDelta::FromMilliseconds(0),
base::TimeDelta::FromMilliseconds(1000000),
100,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter_for_type->AddTime(base::TimeDelta::FromMicroseconds(delta));
bool prevent_default = false;
diff --git a/content/renderer/renderer_main.cc b/content/renderer/renderer_main.cc
index f5bc21b..aaa772f 100644
--- a/content/renderer/renderer_main.cc
+++ b/content/renderer/renderer_main.cc
@@ -81,7 +81,7 @@ class RendererMessageLoopObserver : public MessageLoop::TaskObserver {
private:
base::TimeTicks begin_process_message_;
- base::Histogram* const process_times_;
+ base::HistogramBase* const process_times_;
DISALLOW_COPY_AND_ASSIGN(RendererMessageLoopObserver);
};
diff --git a/net/base/mime_sniffer.cc b/net/base/mime_sniffer.cc
index a6f8198..d53b567 100644
--- a/net/base/mime_sniffer.cc
+++ b/net/base/mime_sniffer.cc
@@ -209,11 +209,11 @@ static const MagicNumber kSniffableTags[] = {
MAGIC_HTML_TAG("p") // Mozilla
};
-static base::Histogram* UMASnifferHistogramGet(const char* name,
- int array_size) {
- base::Histogram* counter =
+static base::HistogramBase* UMASnifferHistogramGet(const char* name,
+ int array_size) {
+ base::HistogramBase* counter =
base::LinearHistogram::FactoryGet(name, 1, array_size - 1, array_size,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
return counter;
}
@@ -266,7 +266,7 @@ static bool MatchMagicNumber(const char* content, size_t size,
static bool CheckForMagicNumbers(const char* content, size_t size,
const MagicNumber* magic, size_t magic_len,
- base::Histogram* counter,
+ base::HistogramBase* counter,
std::string* result) {
for (size_t i = 0; i < magic_len; ++i) {
if (MatchMagicNumber(content, size, &(magic[i]), result)) {
@@ -308,7 +308,7 @@ static bool SniffForHTML(const char* content,
if (!IsAsciiWhitespace(*pos))
break;
}
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTags2",
arraysize(kSniffableTags));
@@ -327,7 +327,7 @@ static bool SniffForMagicNumbers(const char* content,
*have_enough_content &= TruncateSize(kBytesRequiredForMagic, &size);
// Check our big table of Magic Numbers
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kMagicNumbers2",
arraysize(kMagicNumbers));
@@ -369,7 +369,7 @@ static bool SniffXML(const char* content,
// We want to skip XML processing instructions (of the form "<?xml ...")
// and stop at the first "plain" tag, then make a decision on the mime-type
// based on the name (or possibly attributes) of that tag.
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kMagicXML2",
arraysize(kMagicXML));
@@ -454,7 +454,7 @@ static bool SniffBinary(const char* content,
const bool is_truncated = TruncateSize(kMaxBytesToSniff, &size);
// First, we look for a BOM.
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kByteOrderMark2",
arraysize(kByteOrderMark));
@@ -497,7 +497,7 @@ static bool IsUnknownMimeType(const std::string& mime_type) {
// Firefox rejects a mime type if it is exactly */*
"*/*",
};
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kUnknownMimeTypes2",
arraysize(kUnknownMimeTypes) + 1);
@@ -524,7 +524,7 @@ static bool SniffCRX(const char* content,
const std::string& type_hint,
bool* have_enough_content,
std::string* result) {
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kSniffCRX", 3);
@@ -563,7 +563,7 @@ static bool SniffCRX(const char* content,
}
bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) {
- static base::Histogram* should_sniff_counter(NULL);
+ static base::HistogramBase* should_sniff_counter(NULL);
if (!should_sniff_counter)
should_sniff_counter =
UMASnifferHistogramGet("mime_sniffer.ShouldSniffMimeType2", 3);
@@ -590,7 +590,7 @@ bool ShouldSniffMimeType(const GURL& url, const std::string& mime_type) {
"text/xml",
"application/xml",
};
- static base::Histogram* counter(NULL);
+ static base::HistogramBase* counter(NULL);
if (!counter)
counter = UMASnifferHistogramGet("mime_sniffer.kSniffableTypes2",
arraysize(kSniffableTypes) + 1);
diff --git a/net/cookies/cookie_monster.h b/net/cookies/cookie_monster.h
index 10a6350..8a400c2 100644
--- a/net/cookies/cookie_monster.h
+++ b/net/cookies/cookie_monster.h
@@ -30,6 +30,7 @@ class GURL;
namespace base {
class Histogram;
+class HistogramBase;
class TimeTicks;
} // namespace base
@@ -575,18 +576,18 @@ class NET_EXPORT CookieMonster : public CookieStore {
// Histogram variables; see CookieMonster::InitializeHistograms() in
// cookie_monster.cc for details.
- base::Histogram* histogram_expiration_duration_minutes_;
- base::Histogram* histogram_between_access_interval_minutes_;
- base::Histogram* histogram_evicted_last_access_minutes_;
- base::Histogram* histogram_count_;
- base::Histogram* histogram_domain_count_;
- base::Histogram* histogram_etldp1_count_;
- base::Histogram* histogram_domain_per_etldp1_count_;
- base::Histogram* histogram_number_duplicate_db_cookies_;
- base::Histogram* histogram_cookie_deletion_cause_;
- base::Histogram* histogram_time_get_;
- base::Histogram* histogram_time_mac_;
- base::Histogram* histogram_time_blocked_on_load_;
+ base::HistogramBase* histogram_expiration_duration_minutes_;
+ base::HistogramBase* histogram_between_access_interval_minutes_;
+ base::HistogramBase* histogram_evicted_last_access_minutes_;
+ base::HistogramBase* histogram_count_;
+ base::HistogramBase* histogram_domain_count_;
+ base::HistogramBase* histogram_etldp1_count_;
+ base::HistogramBase* histogram_domain_per_etldp1_count_;
+ base::HistogramBase* histogram_number_duplicate_db_cookies_;
+ base::HistogramBase* histogram_cookie_deletion_cause_;
+ base::HistogramBase* histogram_time_get_;
+ base::HistogramBase* histogram_time_mac_;
+ base::HistogramBase* histogram_time_blocked_on_load_;
CookieMap cookies_;
diff --git a/net/cookies/cookie_monster_unittest.cc b/net/cookies/cookie_monster_unittest.cc
index 62140cd..d02b511 100644
--- a/net/cookies/cookie_monster_unittest.cc
+++ b/net/cookies/cookie_monster_unittest.cc
@@ -1922,7 +1922,7 @@ TEST_F(CookieMonsterTest, HistogramCheck) {
// Should match call in InitializeHistograms, but doesn't really matter
// since the histogram should have been initialized by the CM construction
// above.
- base::Histogram* expired_histogram =
+ base::HistogramBase* expired_histogram =
base::Histogram::FactoryGet(
"Cookie.ExpirationDurationMinutes", 1, 10 * 365 * 24 * 60, 50,
base::Histogram::kUmaTargetedHistogramFlag);
diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h
index 992e946..4416acb 100644
--- a/net/disk_cache/histogram_macros.h
+++ b/net/disk_cache/histogram_macros.h
@@ -21,7 +21,7 @@
#define CACHE_HISTOGRAM_CUSTOM_COUNTS(name, sample, min, max, bucket_count) \
do { \
- static base::Histogram* counter(NULL); \
+ static base::HistogramBase* counter(NULL); \
if (!counter || name != counter->histogram_name()) \
counter = base::Histogram::FactoryGet( \
name, min, max, bucket_count, \
@@ -40,7 +40,7 @@
#define CACHE_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) \
do { \
- static base::Histogram* counter(NULL); \
+ static base::HistogramBase* counter(NULL); \
if (!counter || name != counter->histogram_name()) \
counter = base::Histogram::FactoryTimeGet( \
name, min, max, bucket_count, \
@@ -53,7 +53,7 @@
base::TimeDelta::FromSeconds(10), 50)
#define CACHE_HISTOGRAM_ENUMERATION(name, sample, boundary_value) do { \
- static base::Histogram* counter(NULL); \
+ static base::HistogramBase* counter(NULL); \
if (!counter || name != counter->histogram_name()) \
counter = base::LinearHistogram::FactoryGet( \
name, 1, boundary_value, boundary_value + 1, \
diff --git a/net/socket/client_socket_pool_histograms.cc b/net/socket/client_socket_pool_histograms.cc
index d23635f..c1148af 100644
--- a/net/socket/client_socket_pool_histograms.cc
+++ b/net/socket/client_socket_pool_histograms.cc
@@ -13,6 +13,7 @@
namespace net {
using base::Histogram;
+using base::HistogramBase;
using base::LinearHistogram;
ClientSocketPoolHistograms::ClientSocketPoolHistograms(
@@ -22,25 +23,25 @@ ClientSocketPoolHistograms::ClientSocketPoolHistograms(
// UMA_HISTOGRAM_ENUMERATION
socket_type_ = LinearHistogram::FactoryGet("Net.SocketType_" + pool_name, 1,
ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1,
- Histogram::kUmaTargetedHistogramFlag);
+ HistogramBase::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
request_time_ = Histogram::FactoryTimeGet(
"Net.SocketRequestTime_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(10),
- 100, Histogram::kUmaTargetedHistogramFlag);
+ 100, HistogramBase::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
unused_idle_time_ = Histogram::FactoryTimeGet(
"Net.SocketIdleTimeBeforeNextUse_UnusedSocket_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(6),
- 100, Histogram::kUmaTargetedHistogramFlag);
+ 100, HistogramBase::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
reused_idle_time_ = Histogram::FactoryTimeGet(
"Net.SocketIdleTimeBeforeNextUse_ReusedSocket_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(6),
- 100, Histogram::kUmaTargetedHistogramFlag);
+ 100, HistogramBase::kUmaTargetedHistogramFlag);
if (pool_name == "HTTPProxy")
is_http_proxy_connection_ = true;
diff --git a/net/socket/client_socket_pool_histograms.h b/net/socket/client_socket_pool_histograms.h
index 0049afa..83668dc 100644
--- a/net/socket/client_socket_pool_histograms.h
+++ b/net/socket/client_socket_pool_histograms.h
@@ -12,7 +12,7 @@
#include "net/base/net_export.h"
namespace base {
-class Histogram;
+class HistogramBase;
}
namespace net {
@@ -28,10 +28,10 @@ class NET_EXPORT_PRIVATE ClientSocketPoolHistograms {
void AddReusedIdleTime(base::TimeDelta time) const;
private:
- base::Histogram* socket_type_;
- base::Histogram* request_time_;
- base::Histogram* unused_idle_time_;
- base::Histogram* reused_idle_time_;
+ base::HistogramBase* socket_type_;
+ base::HistogramBase* request_time_;
+ base::HistogramBase* unused_idle_time_;
+ base::HistogramBase* reused_idle_time_;
bool is_http_proxy_connection_;
bool is_socks_connection_;
diff --git a/sql/connection.cc b/sql/connection.cc
index e7fa87c..aefac60 100644
--- a/sql/connection.cc
+++ b/sql/connection.cc
@@ -665,10 +665,10 @@ int Connection::OnSqliteError(int err, sql::Statement *stmt) {
// shouldn't execute often enough for such caching to be crucial.
// If it becomes an issue, the object could be cached alongside
// error_histogram_name_.
- base::Histogram* histogram =
+ base::HistogramBase* histogram =
base::LinearHistogram::FactoryGet(
error_histogram_name_, 1, kSqliteErrorMax, kSqliteErrorMax + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
if (histogram)
histogram->Add(base_err);
}
diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc
index 474599c..76bbd3a 100644
--- a/third_party/leveldatabase/env_chromium.cc
+++ b/third_party/leveldatabase/env_chromium.cc
@@ -524,7 +524,7 @@ class ChromiumEnv : public Env, public UMALogger {
return Status::IOError(fname, strerror(errno));
} else {
if (!sync_parent(fname)) {
- fclose(f);
+ fclose(f);
return Status::IOError(fname, strerror(errno));
}
*result = new ChromiumLogger(f);
@@ -572,8 +572,8 @@ class ChromiumEnv : public Env, public UMALogger {
typedef std::deque<BGItem> BGQueue;
BGQueue queue_;
- base::Histogram* io_error_histogram_;
- base::Histogram* random_access_file_histogram_;
+ base::HistogramBase* io_error_histogram_;
+ base::HistogramBase* random_access_file_histogram_;
};
ChromiumEnv::ChromiumEnv()
diff --git a/ui/base/events/event.cc b/ui/base/events/event.cc
index 69794cf..eda682b 100644
--- a/ui/base/events/event.cc
+++ b/ui/base/events/event.cc
@@ -174,13 +174,13 @@ Event::Event(const base::NativeEvent& native_event,
delta.InMicroseconds(), 0, 1000000, 100);
std::string name_for_event =
base::StringPrintf("Event.Latency.Browser.%s", name_.c_str());
- base::Histogram* counter_for_type =
+ base::HistogramBase* counter_for_type =
base::Histogram::FactoryTimeGet(
name_for_event,
base::TimeDelta::FromMilliseconds(0),
base::TimeDelta::FromMilliseconds(1000000),
100,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter_for_type->AddTime(delta);
InitWithNativeEvent(native_event);
}
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index a199422..6ebd52a 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -418,9 +418,9 @@ void WebKitPlatformSupportImpl::histogramCustomCounts(
const char* name, int sample, int min, int max, int bucket_count) {
// Copied from histogram macro, but without the static variable caching
// the histogram because name is dynamic.
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::Histogram::FactoryGet(name, min, max, bucket_count,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
DCHECK_EQ(name, counter->histogram_name());
counter->Add(sample);
}
@@ -429,9 +429,9 @@ void WebKitPlatformSupportImpl::histogramEnumeration(
const char* name, int sample, int boundary_value) {
// Copied from histogram macro, but without the static variable caching
// the histogram because name is dynamic.
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::LinearHistogram::FactoryGet(name, 1, boundary_value,
- boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
+ boundary_value + 1, base::HistogramBase::kUmaTargetedHistogramFlag);
DCHECK_EQ(name, counter->histogram_name());
counter->Add(sample);
}
diff --git a/webkit/plugins/ppapi/ppb_uma_private_impl.cc b/webkit/plugins/ppapi/ppb_uma_private_impl.cc
index ec85c16..fb30a06 100644
--- a/webkit/plugins/ppapi/ppb_uma_private_impl.cc
+++ b/webkit/plugins/ppapi/ppb_uma_private_impl.cc
@@ -36,13 +36,13 @@ void HistogramCustomTimes(PP_Var name,
StringVar* name_string = StringVar::FromPPVar(name);
if (name_string == NULL)
return;
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::Histogram::FactoryTimeGet(
name_string->value(),
base::TimeDelta::FromMilliseconds(min),
base::TimeDelta::FromMilliseconds(max),
bucket_count,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
}
@@ -55,13 +55,13 @@ void HistogramCustomCounts(PP_Var name,
StringVar* name_string = StringVar::FromPPVar(name);
if (name_string == NULL)
return;
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::Histogram::FactoryGet(
name_string->value(),
min,
max,
bucket_count,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->Add(sample);
}
@@ -73,13 +73,13 @@ void HistogramEnumeration(PP_Var name,
StringVar* name_string = StringVar::FromPPVar(name);
if (name_string == NULL)
return;
- base::Histogram* counter =
+ base::HistogramBase* counter =
base::LinearHistogram::FactoryGet(
name_string->value(),
1,
boundary_value,
boundary_value + 1,
- base::Histogram::kUmaTargetedHistogramFlag);
+ base::HistogramBase::kUmaTargetedHistogramFlag);
counter->Add(sample);
}