OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/api/prefs/pref_member.h" | 15 #include "chrome/browser/api/prefs/pref_member.h" |
16 #include "chrome/browser/net/ssl_config_service_manager.h" | 16 #include "chrome/browser/net/ssl_config_service_manager.h" |
17 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
18 #include "content/public/browser/browser_thread_delegate.h" | 18 #include "content/public/browser/browser_thread_delegate.h" |
19 #include "net/base/network_change_notifier.h" | 19 #include "net/base/network_change_notifier.h" |
| 20 #include "net/http/http_network_session.h" |
| 21 #include "net/socket/next_proto.h" |
20 | 22 |
21 class ChromeNetLog; | 23 class ChromeNetLog; |
22 class CommandLine; | 24 class CommandLine; |
23 class PrefProxyConfigTrackerImpl; | 25 class PrefProxyConfigTrackerImpl; |
24 class PrefService; | 26 class PrefService; |
25 class SystemURLRequestContextGetter; | 27 class SystemURLRequestContextGetter; |
26 | 28 |
27 namespace chrome_browser_net { | 29 namespace chrome_browser_net { |
28 class DnsProbeService; | 30 class DnsProbeService; |
29 class HttpPipeliningCompatibilityClient; | 31 class HttpPipeliningCompatibilityClient; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 65 |
64 // Contains state associated with, initialized and cleaned up on, and | 66 // Contains state associated with, initialized and cleaned up on, and |
65 // primarily used on, the IO thread. | 67 // primarily used on, the IO thread. |
66 // | 68 // |
67 // If you are looking to interact with the IO thread (e.g. post tasks | 69 // If you are looking to interact with the IO thread (e.g. post tasks |
68 // to it or check if it is the current thread), see | 70 // to it or check if it is the current thread), see |
69 // content::BrowserThread. | 71 // content::BrowserThread. |
70 class IOThread : public content::BrowserThreadDelegate { | 72 class IOThread : public content::BrowserThreadDelegate { |
71 public: | 73 public: |
72 struct Globals { | 74 struct Globals { |
| 75 template <typename T> |
| 76 class Optional { |
| 77 public: |
| 78 Optional() : set_(false) {} |
| 79 |
| 80 void set(T value) { |
| 81 set_ = true; |
| 82 value_ = value; |
| 83 } |
| 84 void CopyToIfSet(T* value) { |
| 85 if (set_) { |
| 86 *value = value_; |
| 87 } |
| 88 } |
| 89 |
| 90 private: |
| 91 bool set_; |
| 92 T value_; |
| 93 }; |
| 94 |
73 class SystemRequestContextLeakChecker { | 95 class SystemRequestContextLeakChecker { |
74 public: | 96 public: |
75 explicit SystemRequestContextLeakChecker(Globals* globals); | 97 explicit SystemRequestContextLeakChecker(Globals* globals); |
76 ~SystemRequestContextLeakChecker(); | 98 ~SystemRequestContextLeakChecker(); |
77 | 99 |
78 private: | 100 private: |
79 Globals* const globals_; | 101 Globals* const globals_; |
80 }; | 102 }; |
81 | 103 |
82 Globals(); | 104 Globals(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 extension_event_router_forwarder; | 142 extension_event_router_forwarder; |
121 scoped_ptr<chrome_browser_net::HttpPipeliningCompatibilityClient> | 143 scoped_ptr<chrome_browser_net::HttpPipeliningCompatibilityClient> |
122 http_pipelining_compatibility_client; | 144 http_pipelining_compatibility_client; |
123 scoped_ptr<chrome_browser_net::LoadTimeStats> load_time_stats; | 145 scoped_ptr<chrome_browser_net::LoadTimeStats> load_time_stats; |
124 scoped_ptr<net::HostMappingRules> host_mapping_rules; | 146 scoped_ptr<net::HostMappingRules> host_mapping_rules; |
125 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings; | 147 scoped_ptr<net::HttpUserAgentSettings> http_user_agent_settings; |
126 bool ignore_certificate_errors; | 148 bool ignore_certificate_errors; |
127 bool http_pipelining_enabled; | 149 bool http_pipelining_enabled; |
128 uint16 testing_fixed_http_port; | 150 uint16 testing_fixed_http_port; |
129 uint16 testing_fixed_https_port; | 151 uint16 testing_fixed_https_port; |
| 152 Optional<size_t> max_spdy_sessions_per_domain; |
| 153 Optional<size_t> initial_max_spdy_concurrent_streams; |
| 154 Optional<size_t> max_spdy_concurrent_streams_limit; |
| 155 Optional<bool> force_spdy_single_domain; |
| 156 Optional<bool> enable_spdy_ip_pooling; |
| 157 Optional<bool> enable_spdy_credential_frames; |
| 158 Optional<bool> enable_spdy_compression; |
| 159 Optional<bool> enable_spdy_ping_based_connection_checking; |
| 160 Optional<net::NextProto> spdy_default_protocol; |
130 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a | 161 // NetErrorTabHelper uses |dns_probe_service| to send DNS probes when a |
131 // main frame load fails with a DNS error in order to provide more useful | 162 // main frame load fails with a DNS error in order to provide more useful |
132 // information to the renderer so it can show a more specific error page. | 163 // information to the renderer so it can show a more specific error page. |
133 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; | 164 scoped_ptr<chrome_browser_net::DnsProbeService> dns_probe_service; |
134 }; | 165 }; |
135 | 166 |
136 // |net_log| must either outlive the IOThread or be NULL. | 167 // |net_log| must either outlive the IOThread or be NULL. |
137 IOThread(PrefService* local_state, | 168 IOThread(PrefService* local_state, |
138 policy::PolicyService* policy_service, | 169 policy::PolicyService* policy_service, |
139 ChromeNetLog* net_log, | 170 ChromeNetLog* net_log, |
(...skipping 10 matching lines...) Expand all Loading... |
150 void ChangedToOnTheRecord(); | 181 void ChangedToOnTheRecord(); |
151 | 182 |
152 // Returns a getter for the URLRequestContext. Only called on the UI thread. | 183 // Returns a getter for the URLRequestContext. Only called on the UI thread. |
153 net::URLRequestContextGetter* system_url_request_context_getter(); | 184 net::URLRequestContextGetter* system_url_request_context_getter(); |
154 | 185 |
155 // Clears the host cache. Intended to be used to prevent exposing recently | 186 // Clears the host cache. Intended to be used to prevent exposing recently |
156 // visited sites on about:net-internals/#dns and about:dns pages. Must be | 187 // visited sites on about:net-internals/#dns and about:dns pages. Must be |
157 // called on the IO thread. | 188 // called on the IO thread. |
158 void ClearHostCache(); | 189 void ClearHostCache(); |
159 | 190 |
| 191 void InitializeNetworkSessionParams(net::HttpNetworkSession::Params* params); |
| 192 |
160 private: | 193 private: |
161 // Provide SystemURLRequestContextGetter with access to | 194 // Provide SystemURLRequestContextGetter with access to |
162 // InitSystemRequestContext(). | 195 // InitSystemRequestContext(). |
163 friend class SystemURLRequestContextGetter; | 196 friend class SystemURLRequestContextGetter; |
164 | 197 |
165 // BrowserThreadDelegate implementation, runs on the IO thread. | 198 // BrowserThreadDelegate implementation, runs on the IO thread. |
166 // This handles initialization and destruction of state that must | 199 // This handles initialization and destruction of state that must |
167 // live on the IO thread. | 200 // live on the IO thread. |
168 virtual void Init() OVERRIDE; | 201 virtual void Init() OVERRIDE; |
169 virtual void CleanUp() OVERRIDE; | 202 virtual void CleanUp() OVERRIDE; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 294 |
262 // True if SPDY is disabled by policy. | 295 // True if SPDY is disabled by policy. |
263 bool is_spdy_disabled_by_policy_; | 296 bool is_spdy_disabled_by_policy_; |
264 | 297 |
265 base::WeakPtrFactory<IOThread> weak_factory_; | 298 base::WeakPtrFactory<IOThread> weak_factory_; |
266 | 299 |
267 DISALLOW_COPY_AND_ASSIGN(IOThread); | 300 DISALLOW_COPY_AND_ASSIGN(IOThread); |
268 }; | 301 }; |
269 | 302 |
270 #endif // CHROME_BROWSER_IO_THREAD_H_ | 303 #endif // CHROME_BROWSER_IO_THREAD_H_ |
OLD | NEW |