OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_IO_THREAD_H_ | 5 #ifndef CHROME_BROWSER_IO_THREAD_H_ |
6 #define CHROME_BROWSER_IO_THREAD_H_ | 6 #define CHROME_BROWSER_IO_THREAD_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <set> | |
11 #include <string> | 10 #include <string> |
12 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
13 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
15 #include "chrome/browser/browser_process_sub_thread.h" | 14 #include "chrome/browser/browser_process_sub_thread.h" |
16 #include "chrome/browser/net/chrome_network_delegate.h" | 15 #include "chrome/browser/net/chrome_network_delegate.h" |
17 #include "chrome/common/net/predictor_common.h" | 16 #include "chrome/common/net/predictor_common.h" |
18 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
19 | 18 |
20 class ChromeNetLog; | 19 class ChromeNetLog; |
21 class ChromeURLRequestContextGetter; | 20 class ChromeURLRequestContextGetter; |
22 class ListValue; | 21 class ListValue; |
23 class PrefService; | 22 class PrefService; |
24 class PrerenderInterceptor; | 23 class PrerenderInterceptor; |
25 class URLRequestContext; | 24 class URLRequestContext; |
26 | 25 |
27 namespace chrome_browser_net { | 26 namespace chrome_browser_net { |
28 class ConnectInterceptor; | 27 class ConnectInterceptor; |
29 class Predictor; | 28 class Predictor; |
30 } // namespace chrome_browser_net | 29 } // namespace chrome_browser_net |
31 | 30 |
32 namespace net { | 31 namespace net { |
33 class CertVerifier; | 32 class CertVerifier; |
33 class ClientSocketFactory; | |
34 class DnsRRResolver; | 34 class DnsRRResolver; |
35 class HostResolver; | 35 class HostResolver; |
36 class HttpAuthHandlerFactory; | 36 class HttpAuthHandlerFactory; |
37 class ProxyScriptFetcher; | 37 class ProxyScriptFetcher; |
38 class ProxyService; | |
39 class SSLConfigService; | |
38 class URLSecurityManager; | 40 class URLSecurityManager; |
39 } // namespace net | 41 } // namespace net |
40 | 42 |
41 class IOThread : public BrowserProcessSubThread { | 43 class IOThread : public BrowserProcessSubThread { |
42 public: | 44 public: |
43 struct Globals { | 45 struct Globals { |
44 Globals(); | 46 Globals(); |
45 ~Globals(); | 47 ~Globals(); |
46 | 48 |
49 net::ClientSocketFactory* client_socket_factory; | |
eroman
2010/12/23 01:40:59
Where is this freed? Or is GetDefaultFactory a sin
willchan no longer on Chromium
2010/12/23 23:51:58
It surprised me to find out it is a singleton. I
| |
47 scoped_ptr<net::HostResolver> host_resolver; | 50 scoped_ptr<net::HostResolver> host_resolver; |
48 scoped_ptr<net::CertVerifier> cert_verifier; | 51 scoped_ptr<net::CertVerifier> cert_verifier; |
49 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 52 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
53 scoped_refptr<net::SSLConfigService> ssl_config_service; | |
50 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 54 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
55 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; | |
51 scoped_ptr<net::URLSecurityManager> url_security_manager; | 56 scoped_ptr<net::URLSecurityManager> url_security_manager; |
52 ChromeNetworkDelegate network_delegate; | 57 ChromeNetworkDelegate network_delegate; |
58 scoped_refptr<URLRequestContext> proxy_script_fetcher_context; | |
53 }; | 59 }; |
54 | 60 |
55 // |net_log| must either outlive the IOThread or be NULL. | 61 // |net_log| must either outlive the IOThread or be NULL. |
56 IOThread(PrefService* local_state, ChromeNetLog* net_log); | 62 IOThread(PrefService* local_state, ChromeNetLog* net_log); |
57 | 63 |
58 virtual ~IOThread(); | 64 virtual ~IOThread(); |
59 | 65 |
60 // Can only be called on the IO thread. | 66 // Can only be called on the IO thread. |
61 Globals* globals(); | 67 Globals* globals(); |
62 | 68 |
(...skipping 23 matching lines...) Expand all Loading... | |
86 | 92 |
87 // Unregisters |url_request_context_getter| from the IO thread. Only called | 93 // Unregisters |url_request_context_getter| from the IO thread. Only called |
88 // on the IO thread. | 94 // on the IO thread. |
89 void UnregisterURLRequestContextGetter( | 95 void UnregisterURLRequestContextGetter( |
90 ChromeURLRequestContextGetter* url_request_context_getter); | 96 ChromeURLRequestContextGetter* url_request_context_getter); |
91 | 97 |
92 // Handles changing to On The Record mode. Posts a task for this onto the | 98 // Handles changing to On The Record mode. Posts a task for this onto the |
93 // IOThread's message loop. | 99 // IOThread's message loop. |
94 void ChangedToOnTheRecord(); | 100 void ChangedToOnTheRecord(); |
95 | 101 |
96 // Creates a ProxyScriptFetcherImpl which will be automatically aborted | |
97 // during shutdown. | |
98 // This is used to avoid cycles between the ProxyScriptFetcher and the | |
99 // URLRequestContext that owns it (indirectly via the ProxyService). | |
100 net::ProxyScriptFetcher* CreateAndRegisterProxyScriptFetcher( | |
101 URLRequestContext* url_request_context); | |
102 | |
103 protected: | 102 protected: |
104 virtual void Init(); | 103 virtual void Init(); |
105 virtual void CleanUp(); | 104 virtual void CleanUp(); |
106 virtual void CleanUpAfterMessageLoopDestruction(); | 105 virtual void CleanUpAfterMessageLoopDestruction(); |
107 | 106 |
108 private: | 107 private: |
109 class ManagedProxyScriptFetcher; | |
110 typedef std::set<ManagedProxyScriptFetcher*> ProxyScriptFetchers; | |
111 | |
112 static void RegisterPrefs(PrefService* local_state); | 108 static void RegisterPrefs(PrefService* local_state); |
113 | 109 |
114 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( | 110 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
115 net::HostResolver* resolver); | 111 net::HostResolver* resolver); |
116 | 112 |
117 void InitNetworkPredictorOnIOThread( | 113 void InitNetworkPredictorOnIOThread( |
118 bool prefetching_enabled, | 114 bool prefetching_enabled, |
119 base::TimeDelta max_dns_queue_delay, | 115 base::TimeDelta max_dns_queue_delay, |
120 size_t max_speculative_parallel_resolves, | 116 size_t max_speculative_parallel_resolves, |
121 const chrome_common_net::UrlList& startup_urls, | 117 const chrome_common_net::UrlList& startup_urls, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 // which gets posted by calling certain member functions of IOThread. | 149 // which gets posted by calling certain member functions of IOThread. |
154 | 150 |
155 // Note: we user explicit pointers rather than smart pointers to be more | 151 // Note: we user explicit pointers rather than smart pointers to be more |
156 // explicit about destruction order, and ensure that there is no chance that | 152 // explicit about destruction order, and ensure that there is no chance that |
157 // these observers would be used accidentally after we have begun to tear | 153 // these observers would be used accidentally after we have begun to tear |
158 // down. | 154 // down. |
159 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | 155 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; |
160 chrome_browser_net::Predictor* predictor_; | 156 chrome_browser_net::Predictor* predictor_; |
161 scoped_ptr<PrerenderInterceptor> prerender_interceptor_; | 157 scoped_ptr<PrerenderInterceptor> prerender_interceptor_; |
162 | 158 |
163 // List of live ProxyScriptFetchers. | |
164 ProxyScriptFetchers fetchers_; | |
165 | |
166 // Keeps track of all live ChromeURLRequestContextGetters, so the | 159 // Keeps track of all live ChromeURLRequestContextGetters, so the |
167 // ChromeURLRequestContexts can be released during | 160 // ChromeURLRequestContexts can be released during |
168 // IOThread::CleanUpAfterMessageLoopDestruction(). | 161 // IOThread::CleanUpAfterMessageLoopDestruction(). |
169 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; | 162 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; |
170 | 163 |
171 DISALLOW_COPY_AND_ASSIGN(IOThread); | 164 DISALLOW_COPY_AND_ASSIGN(IOThread); |
172 }; | 165 }; |
173 | 166 |
174 #endif // CHROME_BROWSER_IO_THREAD_H_ | 167 #endif // CHROME_BROWSER_IO_THREAD_H_ |
OLD | NEW |