diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 21:30:38 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-25 21:30:38 +0000 |
commit | 66761b95332549f825999e482c17c94675275f49 (patch) | |
tree | fc5307808a2c62f1eff2a9f37db3aff11c5455d9 /net/tools | |
parent | e313f3b11360902a3da9b3b1cc0df2a4792d0867 (diff) | |
download | chromium_src-66761b95332549f825999e482c17c94675275f49.zip chromium_src-66761b95332549f825999e482c17c94675275f49.tar.gz chromium_src-66761b95332549f825999e482c17c94675275f49.tar.bz2 |
Massively simplify the NetworkChangeNotifier infrastructure:
* Use a process-wide object (singleton pattern)
* Create/destroy this object on the main thread, make it outlive all consumers
* Make observer-related functions threadsafe
As a result, the notifier can now be used by any thread (eliminating things like NetworkChangeObserverProxy and NetworkChangeNotifierProxy, and expanding its usefulness); its creation and inner workings are much simplified (eliminating implementation-specific classes); and it is simpler to access (eliminating things like NetworkChangeNotifierThread and a LOT of passing pointers around).
BUG=none
TEST=Unittests; network changes still trigger notifications
Review URL: http://codereview.chromium.org/2802015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/fetch/fetch_client.cc | 16 | ||||
-rw-r--r-- | net/tools/hresolv/hresolv.cc | 2 |
2 files changed, 7 insertions, 11 deletions
diff --git a/net/tools/fetch/fetch_client.cc b/net/tools/fetch/fetch_client.cc index d6ba673..9e2a21c 100644 --- a/net/tools/fetch/fetch_client.cc +++ b/net/tools/fetch/fetch_client.cc @@ -133,7 +133,7 @@ int main(int argc, char**argv) { MessageLoop loop(MessageLoop::TYPE_IO); scoped_refptr<net::HostResolver> host_resolver( - net::CreateSystemHostResolver(NULL)); + net::CreateSystemHostResolver()); scoped_refptr<net::ProxyService> proxy_service( net::ProxyService::CreateNull()); @@ -143,18 +143,14 @@ int main(int argc, char**argv) { scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory( net::HttpAuthHandlerFactory::CreateDefault()); if (use_cache) { - factory = new net::HttpCache(NULL, host_resolver, proxy_service, - ssl_config_service, - http_auth_handler_factory.get(), - NULL, - NULL, - net::HttpCache::DefaultBackend::InMemory(0)); + factory = new net::HttpCache(host_resolver, proxy_service, + ssl_config_service, http_auth_handler_factory.get(), NULL, NULL, + net::HttpCache::DefaultBackend::InMemory(0)); } else { factory = new net::HttpNetworkLayer( - net::ClientSocketFactory::GetDefaultFactory(), NULL, host_resolver, + net::ClientSocketFactory::GetDefaultFactory(), host_resolver, proxy_service, ssl_config_service, http_auth_handler_factory.get(), - NULL, - NULL); + NULL, NULL); } { diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc index c3858ad..9c67070 100644 --- a/net/tools/hresolv/hresolv.cc +++ b/net/tools/hresolv/hresolv.cc @@ -447,7 +447,7 @@ int main(int argc, char** argv) { base::TimeDelta::FromSeconds(0)); scoped_refptr<net::HostResolver> host_resolver( - new net::HostResolverImpl(NULL, cache, NULL, 100u)); + new net::HostResolverImpl(NULL, cache, 100u)); ResolverInvoker invoker(host_resolver.get()); invoker.ResolveAll(hosts_and_times, options.async); |