| 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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 DCHECK(!is_preconnect_); | 454 DCHECK(!is_preconnect_); |
| 455 | 455 |
| 456 bool is_job_orphaned = IsJobOrphaned(job); | 456 bool is_job_orphaned = IsJobOrphaned(job); |
| 457 | 457 |
| 458 // Cache these values in case the job gets deleted. | 458 // Cache these values in case the job gets deleted. |
| 459 const SSLConfig used_ssl_config = job->server_ssl_config(); | 459 const SSLConfig used_ssl_config = job->server_ssl_config(); |
| 460 const ProxyInfo used_proxy_info = job->proxy_info(); | 460 const ProxyInfo used_proxy_info = job->proxy_info(); |
| 461 const bool was_alpn_negotiated = job->was_alpn_negotiated(); | 461 const bool was_alpn_negotiated = job->was_alpn_negotiated(); |
| 462 const NextProto negotiated_protocol = job->negotiated_protocol(); | 462 const NextProto negotiated_protocol = job->negotiated_protocol(); |
| 463 const bool using_spdy = job->using_spdy(); | 463 const bool using_spdy = job->using_spdy(); |
| 464 const NetLogSource source_dependency = job->net_log().source(); |
| 464 | 465 |
| 465 // Cache this so we can still use it if the JobController is deleted. | 466 // Cache this so we can still use it if the JobController is deleted. |
| 466 HttpStreamFactoryImpl* factory = factory_; | 467 HttpStreamFactoryImpl* factory = factory_; |
| 467 | 468 |
| 468 // Notify |request_|. | 469 // Notify |request_|. |
| 469 if (!is_preconnect_ && !is_job_orphaned) { | 470 if (!is_preconnect_ && !is_job_orphaned) { |
| 470 if (job->job_type() == MAIN && alternative_job_net_error_ != OK) | 471 if (job->job_type() == MAIN && alternative_job_net_error_ != OK) |
| 471 ReportBrokenAlternativeService(); | 472 ReportBrokenAlternativeService(); |
| 472 | 473 |
| 473 DCHECK(request_); | 474 DCHECK(request_); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 497 DCHECK(stream); | 498 DCHECK(stream); |
| 498 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, | 499 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, |
| 499 stream.release()); | 500 stream.release()); |
| 500 } | 501 } |
| 501 } | 502 } |
| 502 | 503 |
| 503 // Notify |factory_|. |request_| and |bounded_job_| might be deleted already. | 504 // Notify |factory_|. |request_| and |bounded_job_| might be deleted already. |
| 504 if (spdy_session && spdy_session->IsAvailable()) { | 505 if (spdy_session && spdy_session->IsAvailable()) { |
| 505 factory->OnNewSpdySessionReady(spdy_session, direct, used_ssl_config, | 506 factory->OnNewSpdySessionReady(spdy_session, direct, used_ssl_config, |
| 506 used_proxy_info, was_alpn_negotiated, | 507 used_proxy_info, was_alpn_negotiated, |
| 507 negotiated_protocol, using_spdy); | 508 negotiated_protocol, using_spdy, |
| 509 source_dependency); |
| 508 } | 510 } |
| 509 if (is_job_orphaned) { | 511 if (is_job_orphaned) { |
| 510 OnOrphanedJobComplete(job); | 512 OnOrphanedJobComplete(job); |
| 511 } | 513 } |
| 512 } | 514 } |
| 513 | 515 |
| 514 void HttpStreamFactoryImpl::JobController::OnPreconnectsComplete(Job* job) { | 516 void HttpStreamFactoryImpl::JobController::OnPreconnectsComplete(Job* job) { |
| 515 DCHECK_EQ(main_job_.get(), job); | 517 DCHECK_EQ(main_job_.get(), job); |
| 516 main_job_.reset(); | 518 main_job_.reset(); |
| 517 factory_->OnPreconnectsCompleteInternal(); | 519 factory_->OnPreconnectsCompleteInternal(); |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 return; | 1170 return; |
| 1169 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1171 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
| 1170 alternative_job_->Start(request_->stream_type()); | 1172 alternative_job_->Start(request_->stream_type()); |
| 1171 } | 1173 } |
| 1172 | 1174 |
| 1173 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1175 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
| 1174 return !request_ || (job_bound_ && bound_job_ != job); | 1176 return !request_ || (job_bound_ && bound_job_ != job); |
| 1175 } | 1177 } |
| 1176 | 1178 |
| 1177 } // namespace net | 1179 } // namespace net |
| OLD | NEW |