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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 HostPortPair mapped_origin(origin.host(), origin.port()); | 1017 HostPortPair mapped_origin(origin.host(), origin.port()); |
1018 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); | 1018 ignore_result(ApplyHostMappingRules(original_url, &mapped_origin)); |
1019 QuicServerId server_id(mapped_origin, request_info.privacy_mode); | 1019 QuicServerId server_id(mapped_origin, request_info.privacy_mode); |
1020 | 1020 |
1021 HostPortPair destination( | 1021 HostPortPair destination( |
1022 alternative_service_info.alternative_service.host_port_pair()); | 1022 alternative_service_info.alternative_service.host_port_pair()); |
1023 ignore_result(ApplyHostMappingRules(original_url, &destination)); | 1023 ignore_result(ApplyHostMappingRules(original_url, &destination)); |
1024 | 1024 |
1025 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, | 1025 if (session_->quic_stream_factory()->CanUseExistingSession(server_id, |
1026 destination)) { | 1026 destination)) { |
1027 return alternative_service_info; | 1027 // If advertised versions for QUIC is missing for this |
| 1028 // AlternaitverServiceInfo, by default append the list of QUIC versions |
| 1029 // supported by this instance of network stack. |
| 1030 first_alternative_service_info = alternative_service_info; |
| 1031 if (first_alternative_service_info.alternative_service.protocol == |
| 1032 kProtoQUIC && |
| 1033 first_alternative_service_info.advertised_versions().empty()) { |
| 1034 first_alternative_service_info.set_advertised_versions( |
| 1035 session_->params().quic_supported_versions); |
| 1036 } |
| 1037 return first_alternative_service_info; |
1028 } | 1038 } |
1029 | 1039 |
1030 // Cache this entry if we don't have a non-broken Alt-Svc yet. | 1040 // Cache this entry if we don't have a non-broken Alt-Svc yet. |
1031 if (first_alternative_service_info.alternative_service.protocol == | 1041 if (first_alternative_service_info.alternative_service.protocol == |
1032 kProtoUnknown) | 1042 kProtoUnknown) |
1033 first_alternative_service_info = alternative_service_info; | 1043 first_alternative_service_info = alternative_service_info; |
1034 } | 1044 } |
1035 | 1045 |
1036 // Ask delegate to mark QUIC as broken for the origin. | 1046 // Ask delegate to mark QUIC as broken for the origin. |
1037 if (quic_advertised && quic_all_broken && delegate != nullptr) | 1047 if (quic_advertised && quic_all_broken && delegate != nullptr) |
1038 delegate->OnQuicBroken(); | 1048 delegate->OnQuicBroken(); |
1039 | 1049 |
| 1050 // If advertised versions for QUIC is missing for this |
| 1051 // AlternaitverServiceInfo, by default append the list of QUIC versions |
| 1052 // supported by this instance of network stack. |
| 1053 if (first_alternative_service_info.alternative_service.protocol == |
| 1054 kProtoQUIC && |
| 1055 first_alternative_service_info.advertised_versions().empty()) { |
| 1056 first_alternative_service_info.set_advertised_versions( |
| 1057 session_->params().quic_supported_versions); |
| 1058 } |
| 1059 |
1040 return first_alternative_service_info; | 1060 return first_alternative_service_info; |
1041 } | 1061 } |
1042 | 1062 |
1043 bool HttpStreamFactoryImpl::JobController:: | 1063 bool HttpStreamFactoryImpl::JobController:: |
1044 ShouldCreateAlternativeProxyServerJob( | 1064 ShouldCreateAlternativeProxyServerJob( |
1045 Job* job, | 1065 Job* job, |
1046 const ProxyInfo& proxy_info, | 1066 const ProxyInfo& proxy_info, |
1047 const GURL& url, | 1067 const GURL& url, |
1048 ProxyServer* alternative_proxy_server) const { | 1068 ProxyServer* alternative_proxy_server) const { |
1049 DCHECK(!alternative_proxy_server->is_valid()); | 1069 DCHECK(!alternative_proxy_server->is_valid()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return; | 1158 return; |
1139 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1159 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1140 alternative_job_->Start(request_->stream_type()); | 1160 alternative_job_->Start(request_->stream_type()); |
1141 } | 1161 } |
1142 | 1162 |
1143 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1163 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
1144 return !request_ || (job_bound_ && bound_job_ != job); | 1164 return !request_ || (job_bound_ && bound_job_ != job); |
1145 } | 1165 } |
1146 | 1166 |
1147 } // namespace net | 1167 } // namespace net |
OLD | NEW |