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/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "net/base/completion_callback.h" | 13 #include "net/base/completion_callback.h" |
14 #include "net/base/request_priority.h" | 14 #include "net/base/request_priority.h" |
15 #include "net/http/http_auth.h" | 15 #include "net/http/http_auth.h" |
16 #include "net/http/http_auth_controller.h" | 16 #include "net/http/http_auth_controller.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/log/net_log.h" | 19 #include "net/log/net_log.h" |
20 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
21 #include "net/quic/quic_stream_factory.h" | 21 #include "net/quic/quic_stream_factory.h" |
22 #include "net/socket/client_socket_handle.h" | 22 #include "net/socket/client_socket_handle.h" |
23 #include "net/socket/client_socket_pool_manager.h" | 23 #include "net/socket/client_socket_pool_manager.h" |
24 #include "net/socket/ssl_client_socket.h" | 24 #include "net/socket/ssl_client_socket.h" |
25 #include "net/spdy/spdy_session_key.h" | 25 #include "net/spdy/spdy_session_key.h" |
26 #include "net/ssl/ssl_config_service.h" | 26 #include "net/ssl/ssl_config_service.h" |
27 | 27 |
28 namespace net { | 28 namespace net { |
29 | 29 |
30 class BidirectionalStreamJob; | 30 class BidirectionalStreamImpl; |
31 class ClientSocketHandle; | 31 class ClientSocketHandle; |
32 class HttpAuthController; | 32 class HttpAuthController; |
33 class HttpNetworkSession; | 33 class HttpNetworkSession; |
34 class HttpStream; | 34 class HttpStream; |
35 class SpdySessionPool; | 35 class SpdySessionPool; |
36 class QuicHttpStream; | 36 class QuicHttpStream; |
37 | 37 |
38 // An HttpStreamRequestImpl exists for each stream which is in progress of being | 38 // An HttpStreamRequestImpl exists for each stream which is in progress of being |
39 // created for the StreamFactory. | 39 // created for the StreamFactory. |
40 class HttpStreamFactoryImpl::Job { | 40 class HttpStreamFactoryImpl::Job { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 | 201 |
202 SpdySessionPool* const spdy_session_pool_; | 202 SpdySessionPool* const spdy_session_pool_; |
203 const GURL origin_url_; | 203 const GURL origin_url_; |
204 const bool is_spdy_alternative_; | 204 const bool is_spdy_alternative_; |
205 }; | 205 }; |
206 | 206 |
207 // Resume the |this| job after the specified |wait_time_|. | 207 // Resume the |this| job after the specified |wait_time_|. |
208 void ResumeAfterDelay(); | 208 void ResumeAfterDelay(); |
209 | 209 |
210 void OnStreamReadyCallback(); | 210 void OnStreamReadyCallback(); |
211 void OnBidirectionalStreamJobReadyCallback(); | 211 void OnBidirectionalStreamImplReadyCallback(); |
212 void OnWebSocketHandshakeStreamReadyCallback(); | 212 void OnWebSocketHandshakeStreamReadyCallback(); |
213 // This callback function is called when a new SPDY session is created. | 213 // This callback function is called when a new SPDY session is created. |
214 void OnNewSpdySessionReadyCallback(); | 214 void OnNewSpdySessionReadyCallback(); |
215 void OnStreamFailedCallback(int result); | 215 void OnStreamFailedCallback(int result); |
216 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); | 216 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); |
217 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, | 217 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, |
218 HttpAuthController* auth_controller); | 218 HttpAuthController* auth_controller); |
219 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); | 219 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); |
220 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, | 220 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, |
221 HttpStream* stream); | 221 HttpStream* stream); |
(...skipping 14 matching lines...) Expand all Loading... |
236 int DoWaitForJob(); | 236 int DoWaitForJob(); |
237 int DoWaitForJobComplete(int result); | 237 int DoWaitForJobComplete(int result); |
238 int DoInitConnection(); | 238 int DoInitConnection(); |
239 int DoInitConnectionComplete(int result); | 239 int DoInitConnectionComplete(int result); |
240 int DoWaitingUserAction(int result); | 240 int DoWaitingUserAction(int result); |
241 int DoCreateStream(); | 241 int DoCreateStream(); |
242 int DoCreateStreamComplete(int result); | 242 int DoCreateStreamComplete(int result); |
243 int DoRestartTunnelAuth(); | 243 int DoRestartTunnelAuth(); |
244 int DoRestartTunnelAuthComplete(int result); | 244 int DoRestartTunnelAuthComplete(int result); |
245 | 245 |
246 // Creates a SpdyHttpStream or a BidirectionalStreamJob from the given values | 246 // Creates a SpdyHttpStream or a BidirectionalStreamImpl from the given values |
247 // and sets to |stream_| or |bidirectional_stream_job_| respectively. Does | 247 // and sets to |stream_| or |bidirectional_stream_impl_| respectively. Does |
248 // nothing if |stream_factory_| is for WebSockets. | 248 // nothing if |stream_factory_| is for WebSockets. |
249 int SetSpdyHttpStreamOrBidirectionalStreamJob( | 249 int SetSpdyHttpStreamOrBidirectionalStreamImpl( |
250 base::WeakPtr<SpdySession> session, | 250 base::WeakPtr<SpdySession> session, |
251 bool direct); | 251 bool direct); |
252 | 252 |
253 // Returns to STATE_INIT_CONNECTION and resets some state. | 253 // Returns to STATE_INIT_CONNECTION and resets some state. |
254 void ReturnToStateInitConnection(bool close_connection); | 254 void ReturnToStateInitConnection(bool close_connection); |
255 | 255 |
256 // Set the motivation for this request onto the underlying socket. | 256 // Set the motivation for this request onto the underlying socket. |
257 void SetSocketMotivation(); | 257 void SetSocketMotivation(); |
258 | 258 |
259 bool IsHttpsProxyAndHttpUrl() const; | 259 bool IsHttpsProxyAndHttpUrl() const; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 | 382 |
383 scoped_refptr<HttpAuthController> | 383 scoped_refptr<HttpAuthController> |
384 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; | 384 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; |
385 | 385 |
386 // True when the tunnel is in the process of being established - we can't | 386 // True when the tunnel is in the process of being established - we can't |
387 // read from the socket until the tunnel is done. | 387 // read from the socket until the tunnel is done. |
388 bool establishing_tunnel_; | 388 bool establishing_tunnel_; |
389 | 389 |
390 scoped_ptr<HttpStream> stream_; | 390 scoped_ptr<HttpStream> stream_; |
391 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; | 391 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; |
392 scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job_; | 392 scoped_ptr<BidirectionalStreamImpl> bidirectional_stream_impl_; |
393 | 393 |
394 // True if we negotiated NPN. | 394 // True if we negotiated NPN. |
395 bool was_npn_negotiated_; | 395 bool was_npn_negotiated_; |
396 | 396 |
397 // Protocol negotiated with the server. | 397 // Protocol negotiated with the server. |
398 NextProto protocol_negotiated_; | 398 NextProto protocol_negotiated_; |
399 | 399 |
400 // 0 if we're not preconnecting. Otherwise, the number of streams to | 400 // 0 if we're not preconnecting. Otherwise, the number of streams to |
401 // preconnect. | 401 // preconnect. |
402 int num_streams_; | 402 int num_streams_; |
(...skipping 17 matching lines...) Expand all Loading... |
420 HttpStreamRequest::StreamType stream_type_; | 420 HttpStreamRequest::StreamType stream_type_; |
421 | 421 |
422 base::WeakPtrFactory<Job> ptr_factory_; | 422 base::WeakPtrFactory<Job> ptr_factory_; |
423 | 423 |
424 DISALLOW_COPY_AND_ASSIGN(Job); | 424 DISALLOW_COPY_AND_ASSIGN(Job); |
425 }; | 425 }; |
426 | 426 |
427 } // namespace net | 427 } // namespace net |
428 | 428 |
429 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 429 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |