summaryrefslogtreecommitdiffstats
path: root/net/socket_stream
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/socket_stream
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/socket_stream')
-rw-r--r--net/socket_stream/socket_stream_metrics.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/socket_stream/socket_stream_metrics.cc b/net/socket_stream/socket_stream_metrics.cc
index f7a55a4..6220eb5 100644
--- a/net/socket_stream/socket_stream_metrics.cc
+++ b/net/socket_stream/socket_stream_metrics.cc
@@ -83,19 +83,21 @@ void SocketStreamMetrics::OnClose() {
}
void SocketStreamMetrics::CountProtocolType(ProtocolType protocol_type) {
- static LinearHistogram counter("Net.SocketStream.ProtocolType",
- 0, NUM_PROTOCOL_TYPES,
- NUM_PROTOCOL_TYPES + 1);
- counter.SetFlags(kUmaTargetedHistogramFlag);
- counter.Add(protocol_type);
+ static scoped_refptr<Histogram> counter =
+ LinearHistogram::LinearHistogramFactoryGet(
+ "Net.SocketStream.ProtocolType",
+ 0, NUM_PROTOCOL_TYPES, NUM_PROTOCOL_TYPES + 1);
+ counter->SetFlags(kUmaTargetedHistogramFlag);
+ counter->Add(protocol_type);
}
void SocketStreamMetrics::CountConnectionType(ConnectionType connection_type) {
- static LinearHistogram counter("Net.SocketStream.ConnectionType",
- 1, NUM_CONNECTION_TYPES,
- NUM_CONNECTION_TYPES + 1);
- counter.SetFlags(kUmaTargetedHistogramFlag);
- counter.Add(connection_type);
+ static scoped_refptr<Histogram> counter =
+ LinearHistogram::LinearHistogramFactoryGet(
+ "Net.SocketStream.ConnectionType",
+ 1, NUM_CONNECTION_TYPES, NUM_CONNECTION_TYPES + 1);
+ counter->SetFlags(kUmaTargetedHistogramFlag);
+ counter->Add(connection_type);
}