From 2862086530e94dab7ab55e842601661aabd8a408 Mon Sep 17 00:00:00 2001 From: "rtenneti@chromium.org" Date: Tue, 22 Mar 2011 23:07:19 +0000 Subject: Removed the static on all stats macros and changed the static declaration of StatsCounter, StatsCounterTimer and StatsRate variables to auto. This change would fix possibel race condition during static's initialization in multi-threaded environments. BUG=76980 TEST=unit tests in net, browser and plugins R=jar@chromium.org Review URL: http://codereview.chromium.org/6719011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79065 0039d316-1c4b-4281-b951-d872f2087c98 --- net/udp/udp_socket_libevent.cc | 6 +++--- net/udp/udp_socket_win.cc | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'net/udp') diff --git a/net/udp/udp_socket_libevent.cc b/net/udp/udp_socket_libevent.cc index 6604e7d..85b87c3 100644 --- a/net/udp/udp_socket_libevent.cc +++ b/net/udp/udp_socket_libevent.cc @@ -182,7 +182,7 @@ int UDPSocketLibevent::SendToOrWrite(IOBuffer* buf, int nwrite = InternalSendTo(buf, buf_len, address); if (nwrite >= 0) { - static base::StatsCounter write_bytes("udp.write_bytes"); + base::StatsCounter write_bytes("udp.write_bytes"); write_bytes.Add(nwrite); return nwrite; } @@ -296,7 +296,7 @@ void UDPSocketLibevent::DidCompleteWrite() { int result = InternalSendTo(write_buf_, write_buf_len_, send_to_address_.get()); if (result >= 0) { - static base::StatsCounter write_bytes("udp.write_bytes"); + base::StatsCounter write_bytes("udp.write_bytes"); write_bytes.Add(result); } else { result = MapSystemError(errno); @@ -330,7 +330,7 @@ int UDPSocketLibevent::InternalRecvFrom(IOBuffer* buf, int buf_len, int result; if (bytes_transferred >= 0) { result = bytes_transferred; - static base::StatsCounter read_bytes("udp.read_bytes"); + base::StatsCounter read_bytes("udp.read_bytes"); read_bytes.Add(bytes_transferred); if (address) { if (!address->FromSockAddr(addr, addr_len)) diff --git a/net/udp/udp_socket_win.cc b/net/udp/udp_socket_win.cc index 328f379..2e2271e 100644 --- a/net/udp/udp_socket_win.cc +++ b/net/udp/udp_socket_win.cc @@ -263,7 +263,7 @@ void UDPSocketWin::DidCompleteRead() { } bool UDPSocketWin::ProcessSuccessfulRead(int num_bytes, IPEndPoint* address) { - static base::StatsCounter read_bytes("udp.read_bytes"); + base::StatsCounter read_bytes("udp.read_bytes"); read_bytes.Add(num_bytes); // Convert address. @@ -290,7 +290,7 @@ void UDPSocketWin::DidCompleteWrite() { } void UDPSocketWin::ProcessSuccessfulWrite(int num_bytes) { - static base::StatsCounter write_bytes("udp.write_bytes"); + base::StatsCounter write_bytes("udp.write_bytes"); write_bytes.Add(num_bytes); } -- cgit v1.1