| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 10 #include <string> |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "chrome/browser/browser_process_sub_thread.h" | 14 #include "chrome/browser/browser_process_sub_thread.h" |
| 15 #include "chrome/browser/net/chrome_network_delegate.h" | 15 #include "chrome/browser/net/chrome_network_delegate.h" |
| 16 #include "chrome/common/net/predictor_common.h" | 16 #include "chrome/common/net/predictor_common.h" |
| 17 #include "net/base/network_change_notifier.h" | 17 #include "net/base/network_change_notifier.h" |
| 18 | 18 |
| 19 class ChromeNetLog; | 19 class ChromeNetLog; |
| 20 class ChromeURLRequestContextGetter; | 20 class ChromeURLRequestContextGetter; |
| 21 class ListValue; | 21 class ListValue; |
| 22 class PrefProxyConfigTracker; |
| 22 class PrefService; | 23 class PrefService; |
| 23 | 24 |
| 24 namespace chrome_browser_net { | 25 namespace chrome_browser_net { |
| 25 class ConnectInterceptor; | 26 class ConnectInterceptor; |
| 26 class Predictor; | 27 class Predictor; |
| 27 } // namespace chrome_browser_net | 28 } // namespace chrome_browser_net |
| 28 | 29 |
| 29 namespace net { | 30 namespace net { |
| 30 class CertVerifier; | 31 class CertVerifier; |
| 31 class DnsRRResolver; | 32 class DnsRRResolver; |
| 32 class HostResolver; | 33 class HostResolver; |
| 33 class HttpAuthHandlerFactory; | 34 class HttpAuthHandlerFactory; |
| 34 class HttpTransactionFactory; | 35 class HttpTransactionFactory; |
| 36 class ProxyConfigService; |
| 35 class ProxyScriptFetcher; | 37 class ProxyScriptFetcher; |
| 36 class ProxyService; | 38 class ProxyService; |
| 37 class SSLConfigService; | 39 class SSLConfigService; |
| 38 class URLRequestContext; | 40 class URLRequestContext; |
| 39 class URLSecurityManager; | 41 class URLSecurityManager; |
| 40 } // namespace net | 42 } // namespace net |
| 41 | 43 |
| 42 class IOThread : public BrowserProcessSubThread { | 44 class IOThread : public BrowserProcessSubThread { |
| 43 public: | 45 public: |
| 44 struct Globals { | 46 struct Globals { |
| 45 Globals(); | 47 Globals(); |
| 46 ~Globals(); | 48 ~Globals(); |
| 47 | 49 |
| 48 scoped_ptr<net::HostResolver> host_resolver; | 50 scoped_ptr<net::HostResolver> host_resolver; |
| 49 scoped_ptr<net::CertVerifier> cert_verifier; | 51 scoped_ptr<net::CertVerifier> cert_verifier; |
| 50 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 52 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
| 51 scoped_refptr<net::SSLConfigService> ssl_config_service; | 53 scoped_refptr<net::SSLConfigService> ssl_config_service; |
| 52 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 54 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
| 53 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; | 55 scoped_refptr<net::ProxyService> proxy_script_fetcher_proxy_service; |
| 54 scoped_ptr<net::HttpTransactionFactory> | 56 scoped_ptr<net::HttpTransactionFactory> |
| 55 proxy_script_fetcher_http_transaction_factory; | 57 proxy_script_fetcher_http_transaction_factory; |
| 56 scoped_ptr<net::URLSecurityManager> url_security_manager; | 58 scoped_ptr<net::URLSecurityManager> url_security_manager; |
| 57 ChromeNetworkDelegate network_delegate; | 59 ChromeNetworkDelegate network_delegate; |
| 58 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; | 60 scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context; |
| 61 scoped_ptr<net::HttpTransactionFactory> system_http_transaction_factory; |
| 62 scoped_refptr<net::ProxyService> system_proxy_service; |
| 63 // NOTE(willchan): This request context is unusable until a system |
| 64 // SSLConfigService is provided that doesn't rely on |
| 65 // Profiles. Do NOT use this yet. |
| 66 scoped_refptr<net::URLRequestContext> system_request_context; |
| 59 }; | 67 }; |
| 60 | 68 |
| 61 // |net_log| must either outlive the IOThread or be NULL. | 69 // |net_log| must either outlive the IOThread or be NULL. |
| 62 IOThread(PrefService* local_state, ChromeNetLog* net_log); | 70 IOThread(PrefService* local_state, ChromeNetLog* net_log); |
| 63 | 71 |
| 64 virtual ~IOThread(); | 72 virtual ~IOThread(); |
| 65 | 73 |
| 66 // Can only be called on the IO thread. | 74 // Can only be called on the IO thread. |
| 67 Globals* globals(); | 75 Globals* globals(); |
| 68 | 76 |
| 69 ChromeNetLog* net_log(); | 77 ChromeNetLog* net_log(); |
| 70 | 78 |
| 79 // Triggers an asynchronous initialization of the system request context. |
| 80 // Takes ownership of config_service. Needs to be called from UI thread. |
| 81 void InitSystemRequestContext(net::ProxyConfigService* config_service); |
| 82 |
| 71 // Initializes the network predictor, which induces DNS pre-resolution and/or | 83 // Initializes the network predictor, which induces DNS pre-resolution and/or |
| 72 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS | 84 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS |
| 73 // prefetching should be enabled, and |preconnect_enabled| controls whether | 85 // prefetching should be enabled, and |preconnect_enabled| controls whether |
| 74 // TCP/IP preconnection is enabled. This should be called by the UI thread. | 86 // TCP/IP preconnection is enabled. This should be called by the UI thread. |
| 75 // It will post a task to the IO thread to perform the actual initialization. | 87 // It will post a task to the IO thread to perform the actual initialization. |
| 76 void InitNetworkPredictor(bool prefetching_enabled, | 88 void InitNetworkPredictor(bool prefetching_enabled, |
| 77 base::TimeDelta max_dns_queue_delay, | 89 base::TimeDelta max_dns_queue_delay, |
| 78 size_t max_speculative_parallel_resolves, | 90 size_t max_speculative_parallel_resolves, |
| 79 const chrome_common_net::UrlList& startup_urls, | 91 const chrome_common_net::UrlList& startup_urls, |
| 80 ListValue* referral_list, | 92 ListValue* referral_list, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 virtual void Init(); | 115 virtual void Init(); |
| 104 virtual void CleanUp(); | 116 virtual void CleanUp(); |
| 105 virtual void CleanUpAfterMessageLoopDestruction(); | 117 virtual void CleanUpAfterMessageLoopDestruction(); |
| 106 | 118 |
| 107 private: | 119 private: |
| 108 static void RegisterPrefs(PrefService* local_state); | 120 static void RegisterPrefs(PrefService* local_state); |
| 109 | 121 |
| 110 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( | 122 net::HttpAuthHandlerFactory* CreateDefaultAuthHandlerFactory( |
| 111 net::HostResolver* resolver); | 123 net::HostResolver* resolver); |
| 112 | 124 |
| 125 void InitSystemRequestContextOnIOThread( |
| 126 net::ProxyConfigService* config_service); |
| 127 |
| 113 void InitNetworkPredictorOnIOThread( | 128 void InitNetworkPredictorOnIOThread( |
| 114 bool prefetching_enabled, | 129 bool prefetching_enabled, |
| 115 base::TimeDelta max_dns_queue_delay, | 130 base::TimeDelta max_dns_queue_delay, |
| 116 size_t max_speculative_parallel_resolves, | 131 size_t max_speculative_parallel_resolves, |
| 117 const chrome_common_net::UrlList& startup_urls, | 132 const chrome_common_net::UrlList& startup_urls, |
| 118 ListValue* referral_list, | 133 ListValue* referral_list, |
| 119 bool preconnect_enabled); | 134 bool preconnect_enabled); |
| 120 | 135 |
| 121 void ChangedToOnTheRecordOnIOThread(); | 136 void ChangedToOnTheRecordOnIOThread(); |
| 122 | 137 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 172 |
| 158 // Keeps track of all live ChromeURLRequestContextGetters, so the | 173 // Keeps track of all live ChromeURLRequestContextGetters, so the |
| 159 // ChromeURLRequestContexts can be released during | 174 // ChromeURLRequestContexts can be released during |
| 160 // IOThread::CleanUpAfterMessageLoopDestruction(). | 175 // IOThread::CleanUpAfterMessageLoopDestruction(). |
| 161 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; | 176 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; |
| 162 | 177 |
| 163 DISALLOW_COPY_AND_ASSIGN(IOThread); | 178 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 164 }; | 179 }; |
| 165 | 180 |
| 166 #endif // CHROME_BROWSER_IO_THREAD_H_ | 181 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |