Index: net/tools/fetch/fetch_client.cc |
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc |
index 138bed3b2ea9f4721cd8012a042088ae4f7417c2..800f3070d8b1e0c8fbe61fcc365e783acbcd7f9e 100644 |
--- a/net/tools/fetch/fetch_client.cc |
+++ b/net/tools/fetch/fetch_client.cc |
@@ -6,9 +6,9 @@ |
#include "base/at_exit.h" |
#include "base/command_line.h" |
+#include "base/lazy_instance.h" |
#include "base/message_loop.h" |
#include "base/metrics/stats_counters.h" |
-#include "base/singleton.h" |
#include "base/string_number_conversions.h" |
#include "base/string_util.h" |
#include "net/base/completion_callback.h" |
@@ -47,6 +47,8 @@ class Driver { |
int clients_; |
}; |
+static base::LazyInstance<Driver> g_driver(base::LINKER_INITIALIZED); |
+ |
// A network client |
class Client { |
public: |
@@ -60,7 +62,7 @@ class Client { |
int rv = factory->CreateTransaction(&transaction_); |
DCHECK_EQ(net::OK, rv); |
buffer_->AddRef(); |
- driver_->ClientStarted(); |
+ g_driver.Get().ClientStarted(); |
request_info_.url = url_; |
request_info_.method = "GET"; |
int state = transaction_->Start( |
@@ -101,7 +103,7 @@ class Client { |
void OnRequestComplete(int result) { |
static base::StatsCounter requests("FetchClient.requests"); |
requests.Increment(); |
- driver_->ClientStopped(); |
+ g_driver.Get().ClientStopped(); |
printf("."); |
} |
@@ -112,7 +114,6 @@ class Client { |
scoped_refptr<net::IOBuffer> buffer_; |
net::CompletionCallbackImpl<Client> connect_callback_; |
net::CompletionCallbackImpl<Client> read_callback_; |
- Singleton<Driver> driver_; |
}; |
int main(int argc, char**argv) { |