| 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 <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 if (main_job_) { | 165 if (main_job_) { |
| 166 main_job_->SetPriority(priority); | 166 main_job_->SetPriority(priority); |
| 167 } | 167 } |
| 168 if (alternative_job_) { | 168 if (alternative_job_) { |
| 169 alternative_job_->SetPriority(priority); | 169 alternative_job_->SetPriority(priority); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void HttpStreamFactoryImpl::JobController::OnStreamReady( | 173 void HttpStreamFactoryImpl::JobController::OnStreamReady( |
| 174 Job* job, | 174 Job* job, |
| 175 const SSLConfig& used_ssl_config, | 175 const SSLConfig& used_ssl_config) { |
| 176 const ProxyInfo& used_proxy_info) { | |
| 177 DCHECK(job); | 176 DCHECK(job); |
| 178 // TODO(tbansal): Remove |used_proxy_info| from the method arguments. | |
| 179 DCHECK(job->proxy_info().is_empty() == used_proxy_info.is_empty() || | |
| 180 job->proxy_info().proxy_server() == used_proxy_info.proxy_server()); | |
| 181 | 177 |
| 182 factory_->OnStreamReady(job->proxy_info()); | 178 factory_->OnStreamReady(job->proxy_info()); |
| 183 | 179 |
| 184 if (job_bound_ && bound_job_ != job) { | 180 if (job_bound_ && bound_job_ != job) { |
| 185 // We have bound a job to the associated Request, |job| has been orphaned. | 181 // We have bound a job to the associated Request, |job| has been orphaned. |
| 186 OnOrphanedJobComplete(job); | 182 OnOrphanedJobComplete(job); |
| 187 return; | 183 return; |
| 188 } | 184 } |
| 189 std::unique_ptr<HttpStream> stream = job->ReleaseStream(); | 185 std::unique_ptr<HttpStream> stream = job->ReleaseStream(); |
| 190 DCHECK(stream); | 186 DCHECK(stream); |
| 191 | 187 |
| 192 MarkRequestComplete(job->was_alpn_negotiated(), job->negotiated_protocol(), | 188 MarkRequestComplete(job->was_alpn_negotiated(), job->negotiated_protocol(), |
| 193 job->using_spdy()); | 189 job->using_spdy()); |
| 194 | 190 |
| 195 if (!request_) | 191 if (!request_) |
| 196 return; | 192 return; |
| 197 DCHECK(!factory_->for_websockets_); | 193 DCHECK(!factory_->for_websockets_); |
| 198 DCHECK_EQ(HttpStreamRequest::HTTP_STREAM, request_->stream_type()); | 194 DCHECK_EQ(HttpStreamRequest::HTTP_STREAM, request_->stream_type()); |
| 199 OnJobSucceeded(job); | 195 OnJobSucceeded(job); |
| 200 request_->OnStreamReady(used_ssl_config, used_proxy_info, stream.release()); | 196 request_->OnStreamReady(used_ssl_config, job->proxy_info(), stream.release()); |
| 201 } | 197 } |
| 202 | 198 |
| 203 void HttpStreamFactoryImpl::JobController::OnBidirectionalStreamImplReady( | 199 void HttpStreamFactoryImpl::JobController::OnBidirectionalStreamImplReady( |
| 204 Job* job, | 200 Job* job, |
| 205 const SSLConfig& used_ssl_config, | 201 const SSLConfig& used_ssl_config, |
| 206 const ProxyInfo& used_proxy_info) { | 202 const ProxyInfo& used_proxy_info) { |
| 207 DCHECK(job); | 203 DCHECK(job); |
| 208 | 204 |
| 209 if (job_bound_ && bound_job_ != job) { | 205 if (job_bound_ && bound_job_ != job) { |
| 210 // We have bound a job to the associated Request, |job| has been orphaned. | 206 // We have bound a job to the associated Request, |job| has been orphaned. |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 } | 1079 } |
| 1084 | 1080 |
| 1085 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() { | 1081 void HttpStreamFactoryImpl::JobController::StartAlternativeProxyServerJob() { |
| 1086 if (!alternative_job_ || !request_) | 1082 if (!alternative_job_ || !request_) |
| 1087 return; | 1083 return; |
| 1088 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1084 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
| 1089 alternative_job_->Start(request_->stream_type()); | 1085 alternative_job_->Start(request_->stream_type()); |
| 1090 } | 1086 } |
| 1091 | 1087 |
| 1092 } // namespace net | 1088 } // namespace net |
| OLD | NEW |