OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #include "net/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 | 470 |
471 DCHECK(request_); | 471 DCHECK(request_); |
472 | 472 |
473 // The first case is the usual case. | 473 // The first case is the usual case. |
474 if (!job_bound_) { | 474 if (!job_bound_) { |
475 BindJob(job); | 475 BindJob(job); |
476 } | 476 } |
477 | 477 |
478 MarkRequestComplete(was_alpn_negotiated, negotiated_protocol, using_spdy); | 478 MarkRequestComplete(was_alpn_negotiated, negotiated_protocol, using_spdy); |
479 | 479 |
480 std::unique_ptr<HttpStream> stream; | |
481 std::unique_ptr<BidirectionalStreamImpl> bidirectional_stream_impl; | |
482 | |
483 if (for_websockets()) { | 480 if (for_websockets()) { |
484 // TODO(ricea): Re-instate this code when WebSockets over SPDY is | 481 // TODO(ricea): Re-instate this code when WebSockets over SPDY is |
485 // implemented. | 482 // implemented. |
486 NOTREACHED(); | 483 NOTREACHED(); |
487 } else if (job->stream_type() == HttpStreamRequest::BIDIRECTIONAL_STREAM) { | 484 } else if (job->stream_type() == HttpStreamRequest::BIDIRECTIONAL_STREAM) { |
488 bidirectional_stream_impl = job->ReleaseBidirectionalStream(); | 485 std::unique_ptr<BidirectionalStreamImpl> bidirectional_stream_impl = |
| 486 job->ReleaseBidirectionalStream(); |
489 DCHECK(bidirectional_stream_impl); | 487 DCHECK(bidirectional_stream_impl); |
490 delegate_->OnBidirectionalStreamImplReady( | 488 delegate_->OnBidirectionalStreamImplReady( |
491 used_ssl_config, used_proxy_info, | 489 used_ssl_config, used_proxy_info, |
492 bidirectional_stream_impl.release()); | 490 bidirectional_stream_impl.release()); |
493 } else { | 491 } else { |
494 stream = job->ReleaseStream(); | 492 std::unique_ptr<HttpStream> stream = job->ReleaseStream(); |
495 DCHECK(stream); | 493 DCHECK(stream); |
496 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, | 494 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, |
497 stream.release()); | 495 stream.release()); |
498 } | 496 } |
499 } | 497 } |
500 | 498 |
501 // Notify |factory_|. |request_| and |bounded_job_| might be deleted already. | 499 // Notify |factory_|. |request_| and |bounded_job_| might be deleted already. |
502 if (spdy_session && spdy_session->IsAvailable()) { | 500 if (spdy_session && spdy_session->IsAvailable()) { |
503 factory->OnNewSpdySessionReady(spdy_session, direct, used_ssl_config, | 501 factory->OnNewSpdySessionReady(spdy_session, direct, used_ssl_config, |
504 used_proxy_info, was_alpn_negotiated, | 502 used_proxy_info, was_alpn_negotiated, |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 return; | 1138 return; |
1141 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1139 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1142 alternative_job_->Start(request_->stream_type()); | 1140 alternative_job_->Start(request_->stream_type()); |
1143 } | 1141 } |
1144 | 1142 |
1145 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1143 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
1146 return !request_ || (job_bound_ && bound_job_ != job); | 1144 return !request_ || (job_bound_ && bound_job_ != job); |
1147 } | 1145 } |
1148 | 1146 |
1149 } // namespace net | 1147 } // namespace net |
OLD | NEW |