summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 21:31:44 +0000
committerziadh@chromium.org <ziadh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 21:31:44 +0000
commita764bf5e513ff576f538c34b9ece9df1570e999c (patch)
tree44f5918c5015c1f86244aacf54c6ab90c03c358c
parent79fed69d92dede3b92fd3a175b520ae6949f9233 (diff)
downloadchromium_src-a764bf5e513ff576f538c34b9ece9df1570e999c.zip
chromium_src-a764bf5e513ff576f538c34b9ece9df1570e999c.tar.gz
chromium_src-a764bf5e513ff576f538c34b9ece9df1570e999c.tar.bz2
Refactored Histogram::FactoryGet() to be style-compliant
Currently, two (2) overloaded versions of Histogram::FactoryGet() exist. Google's C++ style guide discourages such implementations. I refactored the methods into Histogram::FactoryGet() (no name change), which takes 'Sample' types as arguments, and Histogram::FactoryTimeGet(), which takes base::TimeDelta types as arguments. r = jar Review URL: http://codereview.chromium.org/2423004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48766 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/histogram.cc4
-rw-r--r--base/histogram.h10
-rw-r--r--chrome/browser/net/websocket_experiment/websocket_experiment_task.cc2
-rw-r--r--net/disk_cache/histogram_macros.h4
-rw-r--r--net/socket/client_socket_pool_histograms.cc6
5 files changed, 13 insertions, 13 deletions
diff --git a/base/histogram.cc b/base/histogram.cc
index dd02c31..1b1720e 100644
--- a/base/histogram.cc
+++ b/base/histogram.cc
@@ -48,7 +48,7 @@ scoped_refptr<Histogram> Histogram::FactoryGet(const std::string& name,
return histogram;
}
-scoped_refptr<Histogram> Histogram::FactoryGet(const std::string& name,
+scoped_refptr<Histogram> Histogram::FactoryTimeGet(const std::string& name,
base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count,
Flags flags) {
return FactoryGet(name, minimum.InMilliseconds(), maximum.InMilliseconds(),
@@ -440,7 +440,7 @@ bool Histogram::DeserializeHistogramInfo(const std::string& histogram_info) {
scoped_refptr<Histogram> render_histogram(NULL);
- if (histogram_type == HISTOGRAM) {
+ if (histogram_type == HISTOGRAM) {
render_histogram = Histogram::FactoryGet(
histogram_name, declared_min, declared_max, bucket_count, flags);
} else if (histogram_type == LINEAR_HISTOGRAM) {
diff --git a/base/histogram.h b/base/histogram.h
index f4cb16e..edcb629 100644
--- a/base/histogram.h
+++ b/base/histogram.h
@@ -70,7 +70,7 @@
// For folks that need real specific times, use this to select a precise range
// of times you want plotted, and the number of buckets you want used.
#define HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) do { \
- static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \
+ static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \
name, min, max, bucket_count, Histogram::kNoFlags); \
DCHECK_EQ(name, counter->histogram_name()); \
counter->AddTime(sample); \
@@ -78,7 +78,7 @@
// DO NOT USE THIS. It is being phased out, in favor of HISTOGRAM_CUSTOM_TIMES.
#define HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \
- static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \
+ static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \
name, min, max, bucket_count, Histogram::kNoFlags); \
DCHECK_EQ(name, counter->histogram_name()); \
if ((sample) < (max)) counter->AddTime(sample); \
@@ -158,7 +158,7 @@
base::TimeDelta::FromHours(1), 50)
#define UMA_HISTOGRAM_CUSTOM_TIMES(name, sample, min, max, bucket_count) do { \
- static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \
+ static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \
name, min, max, bucket_count, Histogram::kUmaTargetedHistogramFlag); \
DCHECK_EQ(name, counter->histogram_name()); \
counter->AddTime(sample); \
@@ -166,7 +166,7 @@
// DO NOT USE THIS. It is being phased out, in favor of HISTOGRAM_CUSTOM_TIMES.
#define UMA_HISTOGRAM_CLIPPED_TIMES(name, sample, min, max, bucket_count) do { \
- static scoped_refptr<Histogram> counter = Histogram::FactoryGet( \
+ static scoped_refptr<Histogram> counter = Histogram::FactoryTimeGet( \
name, min, max, bucket_count, Histogram::kUmaTargetedHistogramFlag); \
DCHECK_EQ(name, counter->histogram_name()); \
if ((sample) < (max)) counter->AddTime(sample); \
@@ -310,7 +310,7 @@ class Histogram : public base::RefCountedThreadSafe<Histogram> {
// default underflow bucket.
static scoped_refptr<Histogram> FactoryGet(const std::string& name,
Sample minimum, Sample maximum, size_t bucket_count, Flags flags);
- static scoped_refptr<Histogram> FactoryGet(const std::string& name,
+ static scoped_refptr<Histogram> FactoryTimeGet(const std::string& name,
base::TimeDelta minimum, base::TimeDelta maximum, size_t bucket_count,
Flags flags);
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
index 0474e12..efc50c8 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
@@ -185,7 +185,7 @@ static Histogram* GetTimesHistogramForConfig(
if (found != g_histogram_table->end()) {
return found->second;
}
- Histogram* counter = Histogram::FactoryGet(
+ Histogram* counter = Histogram::FactoryTimeGet(
counter_name, min, max, bucket_count,
Histogram::kUmaTargetedHistogramFlag);
counter->AddRef(); // Released in ReleaseHistogram().
diff --git a/net/disk_cache/histogram_macros.h b/net/disk_cache/histogram_macros.h
index bbea303..361a9d6 100644
--- a/net/disk_cache/histogram_macros.h
+++ b/net/disk_cache/histogram_macros.h
@@ -36,8 +36,8 @@
do { \
static scoped_refptr<Histogram> counter; \
if (!counter || name != counter->histogram_name()) \
- counter = Histogram::FactoryGet(name, min, max, bucket_count, \
- Histogram::kUmaTargetedHistogramFlag); \
+ counter = Histogram::FactoryTimeGet(name, min, max, bucket_count, \
+ Histogram::kUmaTargetedHistogramFlag); \
counter->AddTime(sample); \
} while (0)
diff --git a/net/socket/client_socket_pool_histograms.cc b/net/socket/client_socket_pool_histograms.cc
index 769257b..e86543d 100644
--- a/net/socket/client_socket_pool_histograms.cc
+++ b/net/socket/client_socket_pool_histograms.cc
@@ -18,19 +18,19 @@ ClientSocketPoolHistograms::ClientSocketPoolHistograms(
ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1,
Histogram::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
- request_time_ = Histogram::FactoryGet(
+ request_time_ = Histogram::FactoryTimeGet(
"Net.SocketRequestTime_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(10),
100, Histogram::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
- unused_idle_time_ = Histogram::FactoryGet(
+ unused_idle_time_ = Histogram::FactoryTimeGet(
"Net.SocketIdleTimeBeforeNextUse_UnusedSocket_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(6),
100, Histogram::kUmaTargetedHistogramFlag);
// UMA_HISTOGRAM_CUSTOM_TIMES
- reused_idle_time_ = Histogram::FactoryGet(
+ reused_idle_time_ = Histogram::FactoryTimeGet(
"Net.SocketIdleTimeBeforeNextUse_ReusedSocket_" + pool_name,
base::TimeDelta::FromMilliseconds(1),
base::TimeDelta::FromMinutes(6),