diff options
Diffstat (limited to 'net/tools/fetch/fetch_client.cc')
-rw-r--r-- | net/tools/fetch/fetch_client.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index 138bed3..800f3070 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) { |