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