| 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> |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 class ProxyScriptFetcher; | 35 class ProxyScriptFetcher; |
| 36 class URLSecurityManager; | 36 class URLSecurityManager; |
| 37 } // namespace net | 37 } // namespace net |
| 38 | 38 |
| 39 class IOThread : public BrowserProcessSubThread { | 39 class IOThread : public BrowserProcessSubThread { |
| 40 public: | 40 public: |
| 41 struct Globals { | 41 struct Globals { |
| 42 Globals(); | 42 Globals(); |
| 43 ~Globals(); | 43 ~Globals(); |
| 44 | 44 |
| 45 scoped_ptr<ChromeNetLog> net_log; | |
| 46 scoped_ptr<net::HostResolver> host_resolver; | 45 scoped_ptr<net::HostResolver> host_resolver; |
| 47 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; | 46 scoped_ptr<net::DnsRRResolver> dnsrr_resolver; |
| 48 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; | 47 scoped_ptr<net::HttpAuthHandlerFactory> http_auth_handler_factory; |
| 49 scoped_ptr<net::URLSecurityManager> url_security_manager; | 48 scoped_ptr<net::URLSecurityManager> url_security_manager; |
| 50 ChromeNetworkDelegate network_delegate; | 49 ChromeNetworkDelegate network_delegate; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 explicit IOThread(PrefService* local_state); | 52 // |net_log| must either outlive the IOThread or be NULL. |
| 53 IOThread(PrefService* local_state, ChromeNetLog* net_log); |
| 54 | 54 |
| 55 virtual ~IOThread(); | 55 virtual ~IOThread(); |
| 56 | 56 |
| 57 // Can only be called on the IO thread. | 57 // Can only be called on the IO thread. |
| 58 Globals* globals(); | 58 Globals* globals(); |
| 59 | 59 |
| 60 ChromeNetLog* net_log(); |
| 61 |
| 60 // Initializes the network predictor, which induces DNS pre-resolution and/or | 62 // Initializes the network predictor, which induces DNS pre-resolution and/or |
| 61 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS | 63 // TCP/IP preconnections. |prefetching_enabled| indicates whether or not DNS |
| 62 // prefetching should be enabled, and |preconnect_enabled| controls whether | 64 // prefetching should be enabled, and |preconnect_enabled| controls whether |
| 63 // TCP/IP preconnection is enabled. This should be called by the UI thread. | 65 // TCP/IP preconnection is enabled. This should be called by the UI thread. |
| 64 // It will post a task to the IO thread to perform the actual initialization. | 66 // It will post a task to the IO thread to perform the actual initialization. |
| 65 void InitNetworkPredictor(bool prefetching_enabled, | 67 void InitNetworkPredictor(bool prefetching_enabled, |
| 66 base::TimeDelta max_dns_queue_delay, | 68 base::TimeDelta max_dns_queue_delay, |
| 67 size_t max_speculative_parallel_resolves, | 69 size_t max_speculative_parallel_resolves, |
| 68 const chrome_common_net::UrlList& startup_urls, | 70 const chrome_common_net::UrlList& startup_urls, |
| 69 ListValue* referral_list, | 71 ListValue* referral_list, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 void InitNetworkPredictorOnIOThread( | 114 void InitNetworkPredictorOnIOThread( |
| 113 bool prefetching_enabled, | 115 bool prefetching_enabled, |
| 114 base::TimeDelta max_dns_queue_delay, | 116 base::TimeDelta max_dns_queue_delay, |
| 115 size_t max_speculative_parallel_resolves, | 117 size_t max_speculative_parallel_resolves, |
| 116 const chrome_common_net::UrlList& startup_urls, | 118 const chrome_common_net::UrlList& startup_urls, |
| 117 ListValue* referral_list, | 119 ListValue* referral_list, |
| 118 bool preconnect_enabled); | 120 bool preconnect_enabled); |
| 119 | 121 |
| 120 void ChangedToOnTheRecordOnIOThread(); | 122 void ChangedToOnTheRecordOnIOThread(); |
| 121 | 123 |
| 124 // The NetLog is owned by the browser process, to allow logging from other |
| 125 // threads during shutdown, but is used most frequently on the IOThread. |
| 126 ChromeNetLog* net_log_; |
| 127 |
| 122 // These member variables are basically global, but their lifetimes are tied | 128 // These member variables are basically global, but their lifetimes are tied |
| 123 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. | 129 // to the IOThread. IOThread owns them all, despite not using scoped_ptr. |
| 124 // This is because the destructor of IOThread runs on the wrong thread. All | 130 // This is because the destructor of IOThread runs on the wrong thread. All |
| 125 // member variables should be deleted in CleanUp(), except ChromeNetLog | 131 // member variables should be deleted in CleanUp(). |
| 126 // which is deleted later in CleanUpAfterMessageLoopDestruction(). | |
| 127 | 132 |
| 128 // These member variables are initialized in Init() and do not change for the | 133 // These member variables are initialized in Init() and do not change for the |
| 129 // lifetime of the IO thread. | 134 // lifetime of the IO thread. |
| 130 | 135 |
| 131 Globals* globals_; | 136 Globals* globals_; |
| 132 | 137 |
| 133 // This variable is only meaningful during shutdown. It is used to defer | |
| 134 // deletion of the NetLog to CleanUpAfterMessageLoopDestruction() even | |
| 135 // though |globals_| is reset by CleanUp(). | |
| 136 scoped_ptr<ChromeNetLog> deferred_net_log_to_delete_; | |
| 137 | |
| 138 // Observer that logs network changes to the ChromeNetLog. | 138 // Observer that logs network changes to the ChromeNetLog. |
| 139 scoped_ptr<net::NetworkChangeNotifier::Observer> network_change_observer_; | 139 scoped_ptr<net::NetworkChangeNotifier::Observer> network_change_observer_; |
| 140 | 140 |
| 141 // Store HTTP Auth-related policies in this thread. | 141 // Store HTTP Auth-related policies in this thread. |
| 142 std::string auth_schemes_; | 142 std::string auth_schemes_; |
| 143 bool negotiate_disable_cname_lookup_; | 143 bool negotiate_disable_cname_lookup_; |
| 144 bool negotiate_enable_port_; | 144 bool negotiate_enable_port_; |
| 145 std::string auth_server_whitelist_; | 145 std::string auth_server_whitelist_; |
| 146 std::string auth_delegate_whitelist_; | 146 std::string auth_delegate_whitelist_; |
| 147 std::string gssapi_library_name_; | 147 std::string gssapi_library_name_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 161 | 161 |
| 162 // Keeps track of all live ChromeURLRequestContextGetters, so the | 162 // Keeps track of all live ChromeURLRequestContextGetters, so the |
| 163 // ChromeURLRequestContexts can be released during | 163 // ChromeURLRequestContexts can be released during |
| 164 // IOThread::CleanUpAfterMessageLoopDestruction(). | 164 // IOThread::CleanUpAfterMessageLoopDestruction(). |
| 165 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; | 165 std::list<ChromeURLRequestContextGetter*> url_request_context_getters_; |
| 166 | 166 |
| 167 DISALLOW_COPY_AND_ASSIGN(IOThread); | 167 DISALLOW_COPY_AND_ASSIGN(IOThread); |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 #endif // CHROME_BROWSER_IO_THREAD_H_ | 170 #endif // CHROME_BROWSER_IO_THREAD_H_ |
| OLD | NEW |