diff options
author | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-06 00:09:37 +0000 |
---|---|---|
committer | jar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-06 00:09:37 +0000 |
commit | e8829a1981a2d9d849c377c28f9444fdefee0f44 (patch) | |
tree | 3cfe522cf76d308dec9fca773d3f9495e12abc5e /net/http | |
parent | 4f3b65a30cad88c1f1e482f7bda69ef50f8e1364 (diff) | |
download | chromium_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/http')
-rw-r--r-- | net/http/http_network_transaction.cc | 49 |
1 files changed, 28 insertions, 21 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index bdf3e3d..7ca82e38 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -996,18 +996,22 @@ void HttpNetworkTransaction::LogTCPConnectedMetrics( 100); } - static LinearHistogram tcp_socket_type_counter( - "Net.TCPSocketType", - 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); - tcp_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); - tcp_socket_type_counter.Add(handle.reuse_type()); + static scoped_refptr<Histogram> tcp_socket_type_counter = + LinearHistogram::LinearHistogramFactoryGet( + "Net.TCPSocketType", + 1, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); + tcp_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag); + tcp_socket_type_counter->Add(handle.reuse_type()); if (use_late_binding_histogram) { - static LinearHistogram tcp_socket_type_counter2( - FieldTrial::MakeName("Net.TCPSocketType", "SocketLateBinding").data(), - 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); - tcp_socket_type_counter2.SetFlags(kUmaTargetedHistogramFlag); - tcp_socket_type_counter2.Add(handle.reuse_type()); + static scoped_refptr<Histogram> tcp_socket_type_counter2 = + LinearHistogram::LinearHistogramFactoryGet( + FieldTrial::MakeName("Net.TCPSocketType", + "SocketLateBinding").data(), + 1, ClientSocketHandle::NUM_TYPES, + ClientSocketHandle::NUM_TYPES + 1); + tcp_socket_type_counter2->SetFlags(kUmaTargetedHistogramFlag); + tcp_socket_type_counter2->Add(handle.reuse_type()); } UMA_HISTOGRAM_CLIPPED_TIMES( @@ -1065,19 +1069,22 @@ void HttpNetworkTransaction::LogIOErrorMetrics( static const bool use_late_binding_histogram = !FieldTrial::MakeName("", "SocketLateBinding").empty(); - static LinearHistogram io_error_socket_type_counter( - "Net.IOError_SocketReuseType", - 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); - io_error_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); - io_error_socket_type_counter.Add(handle.reuse_type()); + static scoped_refptr<Histogram> io_error_socket_type_counter = + LinearHistogram::LinearHistogramFactoryGet( + "Net.IOError_SocketReuseType", + 1, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); + io_error_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag); + io_error_socket_type_counter->Add(handle.reuse_type()); if (use_late_binding_histogram) { - static LinearHistogram io_error_socket_type_counter( - FieldTrial::MakeName("Net.IOError_SocketReuseType", - "SocketLateBinding").data(), - 0, ClientSocketHandle::NUM_TYPES, ClientSocketHandle::NUM_TYPES + 1); - io_error_socket_type_counter.SetFlags(kUmaTargetedHistogramFlag); - io_error_socket_type_counter.Add(handle.reuse_type()); + static scoped_refptr<Histogram> io_error_socket_type_counter = + LinearHistogram::LinearHistogramFactoryGet( + FieldTrial::MakeName("Net.IOError_SocketReuseType", + "SocketLateBinding").data(), + 1, ClientSocketHandle::NUM_TYPES, + ClientSocketHandle::NUM_TYPES + 1); + io_error_socket_type_counter->SetFlags(kUmaTargetedHistogramFlag); + io_error_socket_type_counter->Add(handle.reuse_type()); } switch (handle.reuse_type()) { |