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 NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
12 #include "net/base/net_log.h" | 12 #include "net/base/net_log.h" |
13 #include "net/base/ssl_config_service.h" | 13 #include "net/base/ssl_config_service.h" |
14 #include "net/http/http_auth.h" | 14 #include "net/http/http_auth.h" |
15 #include "net/http/http_auth_controller.h" | 15 #include "net/http/http_auth_controller.h" |
16 #include "net/http/http_pipelined_host.h" | 16 #include "net/http/http_pipelined_host.h" |
17 #include "net/http/http_request_info.h" | 17 #include "net/http/http_request_info.h" |
18 #include "net/http/http_stream_factory_impl.h" | 18 #include "net/http/http_stream_factory_impl.h" |
19 #include "net/proxy/proxy_service.h" | 19 #include "net/proxy/proxy_service.h" |
20 #include "net/socket/client_socket_handle.h" | 20 #include "net/socket/client_socket_handle.h" |
21 #include "net/socket/ssl_client_socket.h" | 21 #include "net/socket/ssl_client_socket.h" |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 | 24 |
25 class ClientSocketHandle; | 25 class ClientSocketHandle; |
26 class HttpAuthController; | 26 class HttpAuthController; |
27 class HttpNetworkSession; | 27 class HttpNetworkSession; |
28 class HttpStream; | 28 class HttpStream; |
29 class SpdySessionPool; | 29 class SpdySessionPool; |
| 30 class QuicHttpStream; |
30 | 31 |
31 // An HttpStreamRequestImpl exists for each stream which is in progress of being | 32 // An HttpStreamRequestImpl exists for each stream which is in progress of being |
32 // created for the StreamFactory. | 33 // created for the StreamFactory. |
33 class HttpStreamFactoryImpl::Job { | 34 class HttpStreamFactoryImpl::Job { |
34 public: | 35 public: |
35 Job(HttpStreamFactoryImpl* stream_factory, | 36 Job(HttpStreamFactoryImpl* stream_factory, |
36 HttpNetworkSession* session, | 37 HttpNetworkSession* session, |
37 const HttpRequestInfo& request_info, | 38 const HttpRequestInfo& request_info, |
38 const SSLConfig& server_ssl_config, | 39 const SSLConfig& server_ssl_config, |
39 const SSLConfig& proxy_ssl_config, | 40 const SSLConfig& proxy_ssl_config, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 | 197 |
197 // Moves this stream request into SPDY mode. | 198 // Moves this stream request into SPDY mode. |
198 void SwitchToSpdyMode(); | 199 void SwitchToSpdyMode(); |
199 | 200 |
200 // Should we force SPDY to run over SSL for this stream request. | 201 // Should we force SPDY to run over SSL for this stream request. |
201 bool ShouldForceSpdySSL() const; | 202 bool ShouldForceSpdySSL() const; |
202 | 203 |
203 // Should we force SPDY to run without SSL for this stream request. | 204 // Should we force SPDY to run without SSL for this stream request. |
204 bool ShouldForceSpdyWithoutSSL() const; | 205 bool ShouldForceSpdyWithoutSSL() const; |
205 | 206 |
| 207 // Should we force QUIC for this stream request. |
| 208 bool ShouldForceQuic() const; |
| 209 |
206 bool IsRequestEligibleForPipelining(); | 210 bool IsRequestEligibleForPipelining(); |
207 | 211 |
208 // Record histograms of latency until Connect() completes. | 212 // Record histograms of latency until Connect() completes. |
209 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); | 213 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); |
210 | 214 |
211 // Invoked by the transport socket pool after host resolution is complete | 215 // Invoked by the transport socket pool after host resolution is complete |
212 // to allow the connection to be aborted, if a matching SPDY session can | 216 // to allow the connection to be aborted, if a matching SPDY session can |
213 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a | 217 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a |
214 // session is found, and OK otherwise. | 218 // session is found, and OK otherwise. |
215 static int OnHostResolution(SpdySessionPool* spdy_session_pool, | 219 static int OnHostResolution(SpdySessionPool* spdy_session_pool, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // If |this| is unable to do so, we'll notify |waiting_job_| that it's ok to | 256 // If |this| is unable to do so, we'll notify |waiting_job_| that it's ok to |
253 // proceed and then race the two Jobs. | 257 // proceed and then race the two Jobs. |
254 Job* waiting_job_; | 258 Job* waiting_job_; |
255 | 259 |
256 // True if handling a HTTPS request, or using SPDY with SSL | 260 // True if handling a HTTPS request, or using SPDY with SSL |
257 bool using_ssl_; | 261 bool using_ssl_; |
258 | 262 |
259 // True if this network transaction is using SPDY instead of HTTP. | 263 // True if this network transaction is using SPDY instead of HTTP. |
260 bool using_spdy_; | 264 bool using_spdy_; |
261 | 265 |
| 266 // True if this network transaction is using QUIC instead of HTTP. |
| 267 bool using_quic_; |
| 268 QuicHttpStream* quic_stream_; |
| 269 |
262 // Force spdy for all connections. | 270 // Force spdy for all connections. |
263 bool force_spdy_always_; | 271 bool force_spdy_always_; |
264 | 272 |
265 // Force spdy only for SSL connections. | 273 // Force spdy only for SSL connections. |
266 bool force_spdy_over_ssl_; | 274 bool force_spdy_over_ssl_; |
267 | 275 |
| 276 // Force quic for a specific port. |
| 277 int force_quic_port_; |
| 278 |
268 // The certificate error while using SPDY over SSL for insecure URLs. | 279 // The certificate error while using SPDY over SSL for insecure URLs. |
269 int spdy_certificate_error_; | 280 int spdy_certificate_error_; |
270 | 281 |
271 scoped_refptr<HttpAuthController> | 282 scoped_refptr<HttpAuthController> |
272 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; | 283 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; |
273 | 284 |
274 // True when the tunnel is in the process of being established - we can't | 285 // True when the tunnel is in the process of being established - we can't |
275 // read from the socket until the tunnel is done. | 286 // read from the socket until the tunnel is done. |
276 bool establishing_tunnel_; | 287 bool establishing_tunnel_; |
277 | 288 |
(...skipping 25 matching lines...) Expand all Loading... |
303 bool existing_available_pipeline_; | 314 bool existing_available_pipeline_; |
304 | 315 |
305 base::WeakPtrFactory<Job> ptr_factory_; | 316 base::WeakPtrFactory<Job> ptr_factory_; |
306 | 317 |
307 DISALLOW_COPY_AND_ASSIGN(Job); | 318 DISALLOW_COPY_AND_ASSIGN(Job); |
308 }; | 319 }; |
309 | 320 |
310 } // namespace net | 321 } // namespace net |
311 | 322 |
312 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 323 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |