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 <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
262 // resumes the main job. | 262 // resumes the main job. |
263 // | 263 // |
264 // A QUIC alternative job notifies the JobController in DoInitConnection | 264 // A QUIC alternative job notifies the JobController in DoInitConnection |
265 // regardless of whether it pools to an existing QUIC session, but the main | 265 // regardless of whether it pools to an existing QUIC session, but the main |
266 // job is only resumed after some delay. | 266 // job is only resumed after some delay. |
267 // | 267 // |
268 // If the main job is resumed, then it races the alternative job. | 268 // If the main job is resumed, then it races the alternative job. |
269 STATE_WAIT, | 269 STATE_WAIT, |
270 STATE_WAIT_COMPLETE, | 270 STATE_WAIT_COMPLETE, |
271 | 271 |
272 STATE_BEFORE_INIT_CONNECTION, | |
Ryan Hamilton
2017/06/12 13:30:49
nit: Instead of "before init connection" there the
xunjieli
2017/06/13 15:23:10
Done.
| |
272 STATE_INIT_CONNECTION, | 273 STATE_INIT_CONNECTION, |
273 STATE_INIT_CONNECTION_COMPLETE, | 274 STATE_INIT_CONNECTION_COMPLETE, |
274 STATE_WAITING_USER_ACTION, | 275 STATE_WAITING_USER_ACTION, |
275 STATE_RESTART_TUNNEL_AUTH, | 276 STATE_RESTART_TUNNEL_AUTH, |
276 STATE_RESTART_TUNNEL_AUTH_COMPLETE, | 277 STATE_RESTART_TUNNEL_AUTH_COMPLETE, |
277 STATE_CREATE_STREAM, | 278 STATE_CREATE_STREAM, |
278 STATE_CREATE_STREAM_COMPLETE, | 279 STATE_CREATE_STREAM_COMPLETE, |
279 STATE_DRAIN_BODY_FOR_AUTH_RESTART, | 280 STATE_DRAIN_BODY_FOR_AUTH_RESTART, |
280 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, | 281 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, |
281 STATE_DONE, | 282 STATE_DONE, |
(...skipping 24 matching lines...) Expand all Loading... | |
306 int StartInternal(); | 307 int StartInternal(); |
307 int DoInitConnectionImpl(); | 308 int DoInitConnectionImpl(); |
308 | 309 |
309 // Each of these methods corresponds to a State value. Those with an input | 310 // Each of these methods corresponds to a State value. Those with an input |
310 // argument receive the result from the previous state. If a method returns | 311 // argument receive the result from the previous state. If a method returns |
311 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the | 312 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the |
312 // next state method as the result arg. | 313 // next state method as the result arg. |
313 int DoStart(); | 314 int DoStart(); |
314 int DoWait(); | 315 int DoWait(); |
315 int DoWaitComplete(int result); | 316 int DoWaitComplete(int result); |
317 int DoBeforeInitConnection(); | |
318 int DoBeforeInitConnectionComplete(int result); | |
316 int DoInitConnection(); | 319 int DoInitConnection(); |
317 int DoInitConnectionComplete(int result); | 320 int DoInitConnectionComplete(int result); |
318 int DoWaitingUserAction(int result); | 321 int DoWaitingUserAction(int result); |
319 int DoCreateStream(); | 322 int DoCreateStream(); |
320 int DoCreateStreamComplete(int result); | 323 int DoCreateStreamComplete(int result); |
321 int DoRestartTunnelAuth(); | 324 int DoRestartTunnelAuth(); |
322 int DoRestartTunnelAuthComplete(int result); | 325 int DoRestartTunnelAuthComplete(int result); |
323 | 326 |
327 void ResumeInitConnection(); | |
324 // Creates a SpdyHttpStream or a BidirectionalStreamImpl from the given values | 328 // Creates a SpdyHttpStream or a BidirectionalStreamImpl from the given values |
325 // and sets to |stream_| or |bidirectional_stream_impl_| respectively. Does | 329 // and sets to |stream_| or |bidirectional_stream_impl_| respectively. Does |
326 // nothing if |stream_factory_| is for WebSockets. | 330 // nothing if |stream_factory_| is for WebSockets. |
327 int SetSpdyHttpStreamOrBidirectionalStreamImpl( | 331 int SetSpdyHttpStreamOrBidirectionalStreamImpl( |
328 base::WeakPtr<SpdySession> session, | 332 base::WeakPtr<SpdySession> session, |
329 bool direct); | 333 bool direct); |
330 | 334 |
331 // Returns to STATE_INIT_CONNECTION and resets some state. | 335 // Returns to STATE_INIT_CONNECTION and resets some state. |
332 void ReturnToStateInitConnection(bool close_connection); | 336 void ReturnToStateInitConnection(bool close_connection); |
333 | 337 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 // True if not connecting to an Https proxy for an Http url. | 477 // True if not connecting to an Https proxy for an Http url. |
474 const bool spdy_session_direct_; | 478 const bool spdy_session_direct_; |
475 | 479 |
476 const SpdySessionKey spdy_session_key_; | 480 const SpdySessionKey spdy_session_key_; |
477 | 481 |
478 base::TimeTicks job_stream_ready_start_time_; | 482 base::TimeTicks job_stream_ready_start_time_; |
479 | 483 |
480 // Type of stream that is requested. | 484 // Type of stream that is requested. |
481 HttpStreamRequest::StreamType stream_type_; | 485 HttpStreamRequest::StreamType stream_type_; |
482 | 486 |
487 // Whether the Job should continue to DoInitConnection(). | |
Bence
2017/06/09 19:17:38
Isn't it rather whether the Job has already contin
xunjieli
2017/06/13 15:23:10
Done.
| |
488 bool resumed_init_connection_; | |
Bence
2017/06/09 19:17:38
Optional: init_connection_already_resumed_.
xunjieli
2017/06/13 15:23:10
Done.
| |
489 | |
483 base::WeakPtrFactory<Job> ptr_factory_; | 490 base::WeakPtrFactory<Job> ptr_factory_; |
484 | 491 |
485 DISALLOW_COPY_AND_ASSIGN(Job); | 492 DISALLOW_COPY_AND_ASSIGN(Job); |
486 }; | 493 }; |
487 | 494 |
488 // Factory for creating Jobs. | 495 // Factory for creating Jobs. |
489 class HttpStreamFactoryImpl::JobFactory { | 496 class HttpStreamFactoryImpl::JobFactory { |
490 public: | 497 public: |
491 JobFactory(); | 498 JobFactory(); |
492 | 499 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
533 HostPortPair destination, | 540 HostPortPair destination, |
534 GURL origin_url, | 541 GURL origin_url, |
535 const ProxyServer& alternative_proxy_server, | 542 const ProxyServer& alternative_proxy_server, |
536 bool enable_ip_based_pooling, | 543 bool enable_ip_based_pooling, |
537 NetLog* net_log); | 544 NetLog* net_log); |
538 }; | 545 }; |
539 | 546 |
540 } // namespace net | 547 } // namespace net |
541 | 548 |
542 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 549 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |