From 869336177906f183c223f304c8455b424d64b54f Mon Sep 17 00:00:00 2001 From: "eroman@chromium.org" Date: Sat, 16 Oct 2010 23:10:33 +0000 Subject: Cleanup: Move the ProxyScriptFetcher registry from being a global in net, to living in IOThread. I had to make some other changes to make this fit well: moved ProxyScriptFetcherImpl to its own set of files, and added a IOThread::Get() accessor to avoid plumbing through several layers in connection_tester. I find the registry living in IOThread is preferable, as globals in net/ limit the ability to run on safely on multiple threads, and also leads to confusion on what needs to be called at shutdown. Review URL: http://codereview.chromium.org/3823001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62876 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/io_thread.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'chrome/browser/io_thread.h') diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h index 79891c9..2baec87 100644 --- a/chrome/browser/io_thread.h +++ b/chrome/browser/io_thread.h @@ -6,6 +6,8 @@ #define CHROME_BROWSER_IO_THREAD_H_ #pragma once +#include + #include "base/basictypes.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" @@ -16,6 +18,7 @@ class ChromeNetLog; class ListValue; +class URLRequestContext; namespace chrome_browser_net { class ConnectInterceptor; @@ -26,6 +29,7 @@ namespace net { class DnsRRResolver; class HostResolver; class HttpAuthHandlerFactory; +class ProxyScriptFetcher; class URLSecurityManager; } // namespace net @@ -66,12 +70,22 @@ class IOThread : public BrowserProcessSubThread { // IOThread's message loop. void ChangedToOnTheRecord(); + // Creates a ProxyScriptFetcherImpl which will be automatically aborted + // during shutdown. + // This is used to avoid cycles between the ProxyScriptFetcher and the + // URLRequestContext that owns it (indirectly via the ProxyService). + net::ProxyScriptFetcher* CreateAndRegisterProxyScriptFetcher( + URLRequestContext* url_request_context); + protected: virtual void Init(); virtual void CleanUp(); virtual void CleanUpAfterMessageLoopDestruction(); private: + class ManagedProxyScriptFetcher; + typedef std::set ProxyScriptFetchers; + net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( net::HostResolver* resolver); @@ -115,6 +129,9 @@ class IOThread : public BrowserProcessSubThread { chrome_browser_net::ConnectInterceptor* speculative_interceptor_; chrome_browser_net::Predictor* predictor_; + // List of live ProxyScriptFetchers. + ProxyScriptFetchers fetchers_; + DISALLOW_COPY_AND_ASSIGN(IOThread); }; -- cgit v1.1