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> | 10 #include <set> |
eroman
2010/12/22 01:27:56
Can this be deleted?
willchan no longer on Chromium
2010/12/22 02:35:07
Done.
| |
11 #include <string> | 11 #include <string> |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "chrome/browser/browser_process_sub_thread.h" | 15 #include "chrome/browser/browser_process_sub_thread.h" |
16 #include "chrome/browser/net/chrome_network_delegate.h" | 16 #include "chrome/browser/net/chrome_network_delegate.h" |
17 #include "chrome/common/net/predictor_common.h" | 17 #include "chrome/common/net/predictor_common.h" |
18 #include "net/base/network_change_notifier.h" | 18 #include "net/base/network_change_notifier.h" |
19 | 19 |
20 class ChromeNetLog; | 20 class ChromeNetLog; |
21 class ChromeURLRequestContextGetter; | 21 class ChromeURLRequestContextGetter; |
22 class ListValue; | 22 class ListValue; |
23 class PrefService; | 23 class PrefService; |
24 class PrerenderInterceptor; | 24 class PrerenderInterceptor; |
25 class URLRequestContext; | 25 class URLRequestContext; |
26 | 26 |
27 namespace chrome_browser_net { | 27 namespace chrome_browser_net { |
28 class ConnectInterceptor; | 28 class ConnectInterceptor; |
29 class Predictor; | 29 class Predictor; |
30 } // namespace chrome_browser_net | 30 } // namespace chrome_browser_net |
31 | 31 |
32 namespace net { | 32 namespace net { |
33 class CertVerifier; | 33 class CertVerifier; |
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 |
47 scoped_ptr<net::HostResolver> host_resolver; | 49 scoped_ptr<net::HostResolver> host_resolver; |
48 scoped_ptr<net::CertVerifier> cert_verifier; | 50 scoped_ptr<net::CertVerifier> cert_verifier; |
49 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 51 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
52 scoped_refptr<net::SSLConfigService> ssl_config_service; | |
50 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 53 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
54 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; | |
51 scoped_ptr<net::URLSecurityManager> url_security_manager; | 55 scoped_ptr<net::URLSecurityManager> url_security_manager; |
52 ChromeNetworkDelegate network_delegate; | 56 ChromeNetworkDelegate network_delegate; |
57 scoped_refptr<URLRequestContext> proxy_request_context; | |
eroman
2010/12/22 01:27:56
naming: I think this would be better called someth
willchan no longer on Chromium
2010/12/22 02:35:07
Done.
| |
53 }; | 58 }; |
54 | 59 |
55 // |net_log| must either outlive the IOThread or be NULL. | 60 // |net_log| must either outlive the IOThread or be NULL. |
56 IOThread(PrefService* local_state, ChromeNetLog* net_log); | 61 IOThread(PrefService* local_state, ChromeNetLog* net_log); |
57 | 62 |
58 virtual ~IOThread(); | 63 virtual ~IOThread(); |
59 | 64 |
60 // Can only be called on the IO thread. | 65 // Can only be called on the IO thread. |
61 Globals* globals(); | 66 Globals* globals(); |
62 | 67 |
(...skipping 23 matching lines...) Expand all Loading... | |
86 | 91 |
87 // Unregisters |url_request_context_getter| from the IO thread. Only called | 92 // Unregisters |url_request_context_getter| from the IO thread. Only called |
88 // on the IO thread. | 93 // on the IO thread. |
89 void UnregisterURLRequestContextGetter( | 94 void UnregisterURLRequestContextGetter( |
90 ChromeURLRequestContextGetter* url_request_context_getter); | 95 ChromeURLRequestContextGetter* url_request_context_getter); |
91 | 96 |
92 // Handles changing to On The Record mode. Posts a task for this onto the | 97 // Handles changing to On The Record mode. Posts a task for this onto the |
93 // IOThread's message loop. | 98 // IOThread's message loop. |
94 void ChangedToOnTheRecord(); | 99 void ChangedToOnTheRecord(); |
95 | 100 |
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: | 101 protected: |
104 virtual void Init(); | 102 virtual void Init(); |
105 virtual void CleanUp(); | 103 virtual void CleanUp(); |
106 virtual void CleanUpAfterMessageLoopDestruction(); | 104 virtual void CleanUpAfterMessageLoopDestruction(); |
107 | 105 |
108 private: | 106 private: |
109 class ManagedProxyScriptFetcher; | |
110 typedef std::set<ManagedProxyScriptFetcher*> ProxyScriptFetchers; | |
111 | |
112 static void RegisterPrefs(PrefService* local_state); | 107 static void RegisterPrefs(PrefService* local_state); |
113 | 108 |
114 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( | 109 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
115 net::HostResolver* resolver); | 110 net::HostResolver* resolver); |
116 | 111 |
117 void InitNetworkPredictorOnIOThread( | 112 void InitNetworkPredictorOnIOThread( |
118 bool prefetching_enabled, | 113 bool prefetching_enabled, |
119 base::TimeDelta max_dns_queue_delay, | 114 base::TimeDelta max_dns_queue_delay, |
120 size_t max_speculative_parallel_resolves, | 115 size_t max_speculative_parallel_resolves, |
121 const chrome_common_net::UrlList& startup_urls, | 116 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. | 148 // which gets posted by calling certain member functions of IOThread. |
154 | 149 |
155 // Note: we user explicit pointers rather than smart pointers to be more | 150 // 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 | 151 // 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 | 152 // these observers would be used accidentally after we have begun to tear |
158 // down. | 153 // down. |
159 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; | 154 chrome_browser_net::ConnectInterceptor* speculative_interceptor_; |
160 chrome_browser_net::Predictor* predictor_; | 155 chrome_browser_net::Predictor* predictor_; |
161 scoped_ptr<PrerenderInterceptor> prerender_interceptor_; | 156 scoped_ptr<PrerenderInterceptor> prerender_interceptor_; |
162 | 157 |
163 // List of live ProxyScriptFetchers. | |
164 ProxyScriptFetchers fetchers_; | |
165 | |
166 // Keeps track of all live ChromeURLRequestContextGetters, so the | 158 // Keeps track of all live ChromeURLRequestContextGetters, so the |
167 // ChromeURLRequestContexts can be released during | 159 // ChromeURLRequestContexts can be released during |
168 // IOThread::CleanUpAfterMessageLoopDestruction(). | 160 // IOThread::CleanUpAfterMessageLoopDestruction(). |
169 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; | 161 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; |
170 | 162 |
171 DISALLOW_COPY_AND_ASSIGN(IOThread); | 163 DISALLOW_COPY_AND_ASSIGN(IOThread); |
172 }; | 164 }; |
173 | 165 |
174 #endif // CHROME_BROWSER_IO_THREAD_H_ | 166 #endif // CHROME_BROWSER_IO_THREAD_H_ |
OLD | NEW |