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