summaryrefslogtreecommitdiffstats
path: root/net/ftp
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-06 00:09:37 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-06 00:09:37 +0000
commite8829a1981a2d9d849c377c28f9444fdefee0f44 (patch)
tree3cfe522cf76d308dec9fca773d3f9495e12abc5e /net/ftp
parent4f3b65a30cad88c1f1e482f7bda69ef50f8e1364 (diff)
downloadchromium_src-e8829a1981a2d9d849c377c28f9444fdefee0f44.zip
chromium_src-e8829a1981a2d9d849c377c28f9444fdefee0f44.tar.gz
chromium_src-e8829a1981a2d9d849c377c28f9444fdefee0f44.tar.bz2
Use factory to create histograms, and refcounts to track lifetimes
This is CL patch 377028 by Raman Tenneti, with minor changes to make the try-bots happier. It is cleanup that better ensures lifetimes of histograms (making it harder for users to abuse them). bug=16495 (repairs leak induced by the first landing) bug=18840 (should make leaks less possible) tbr=raman.tenneti Review URL: http://codereview.chromium.org/462027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33933 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/ftp')
-rw-r--r--net/ftp/ftp_network_transaction.cc22
-rw-r--r--net/ftp/ftp_server_type_histograms.cc22
2 files changed, 24 insertions, 20 deletions
diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc
index 1dfc99b..8014d07 100644
--- a/net/ftp/ftp_network_transaction.cc
+++ b/net/ftp/ftp_network_transaction.cc
@@ -1162,21 +1162,23 @@ void FtpNetworkTransaction::RecordDataConnectionError(int result) {
break;
};
static bool had_error_type[NUM_OF_NET_ERROR_TYPES];
- static LinearHistogram error_flagged("Net.FtpDataConnectionErrorHappened",
- 1, NUM_OF_NET_ERROR_TYPES,
- NUM_OF_NET_ERROR_TYPES + 1);
- static LinearHistogram error_counter("Net.FtpDataConnectionErrorCount",
- 1, NUM_OF_NET_ERROR_TYPES,
- NUM_OF_NET_ERROR_TYPES + 1);
+ static scoped_refptr<Histogram> error_flagged =
+ LinearHistogram::LinearHistogramFactoryGet(
+ "Net.FtpDataConnectionErrorHappened",
+ 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
+ static scoped_refptr<Histogram> error_counter =
+ LinearHistogram::LinearHistogramFactoryGet(
+ "Net.FtpDataConnectionErrorCount",
+ 1, NUM_OF_NET_ERROR_TYPES, NUM_OF_NET_ERROR_TYPES + 1);
DCHECK(type >= 0 && type < NUM_OF_NET_ERROR_TYPES);
if (!had_error_type[type]) {
had_error_type[type] = true;
- error_flagged.SetFlags(kUmaTargetedHistogramFlag);
- error_flagged.Add(type);
+ error_flagged->SetFlags(kUmaTargetedHistogramFlag);
+ error_flagged->Add(type);
}
- error_counter.SetFlags(kUmaTargetedHistogramFlag);
- error_counter.Add(type);
+ error_counter->SetFlags(kUmaTargetedHistogramFlag);
+ error_counter->Add(type);
}
} // namespace net
diff --git a/net/ftp/ftp_server_type_histograms.cc b/net/ftp/ftp_server_type_histograms.cc
index 3f419a8..60ab9b9 100644
--- a/net/ftp/ftp_server_type_histograms.cc
+++ b/net/ftp/ftp_server_type_histograms.cc
@@ -22,22 +22,24 @@ namespace net {
// expansion.
void UpdateFtpServerTypeHistograms(FtpServerType type) {
static bool had_server_type[NUM_OF_SERVER_TYPES];
- static LinearHistogram counter1("Net.HadFtpServerType",
- 1, NUM_OF_SERVER_TYPES,
- NUM_OF_SERVER_TYPES + 1);
- static LinearHistogram counter2("Net.FtpServerTypeCount",
- 1, NUM_OF_SERVER_TYPES,
- NUM_OF_SERVER_TYPES + 1);
+ static scoped_refptr<Histogram> counter1 =
+ LinearHistogram::LinearHistogramFactoryGet("Net.HadFtpServerType",
+ 1, NUM_OF_SERVER_TYPES,
+ NUM_OF_SERVER_TYPES + 1);
+ static scoped_refptr<Histogram> counter2 =
+ LinearHistogram::LinearHistogramFactoryGet("Net.FtpServerTypeCount",
+ 1, NUM_OF_SERVER_TYPES,
+ NUM_OF_SERVER_TYPES + 1);
if (type >= 0 && type < NUM_OF_SERVER_TYPES) {
if (!had_server_type[type]) {
had_server_type[type] = true;
- counter1.SetFlags(kUmaTargetedHistogramFlag);
- counter1.Add(type);
+ counter1->SetFlags(kUmaTargetedHistogramFlag);
+ counter1->Add(type);
}
}
- counter2.SetFlags(kUmaTargetedHistogramFlag);
- counter2.Add(type);
+ counter2->SetFlags(kUmaTargetedHistogramFlag);
+ counter2->Add(type);
}
} // namespace net