| 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 #include "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 const HttpRequestInfo& request_info, | 126 const HttpRequestInfo& request_info, |
| 127 const SSLConfig& server_ssl_config, | 127 const SSLConfig& server_ssl_config, |
| 128 const SSLConfig& proxy_ssl_config) { | 128 const SSLConfig& proxy_ssl_config) { |
| 129 DCHECK(!for_websockets_); | 129 DCHECK(!for_websockets_); |
| 130 AlternativeService alternative_service; | 130 AlternativeService alternative_service; |
| 131 AlternativeServiceVector alternative_service_vector = | 131 AlternativeServiceVector alternative_service_vector = |
| 132 GetAlternativeServicesFor(request_info.url); | 132 GetAlternativeServicesFor(request_info.url); |
| 133 if (!alternative_service_vector.empty()) { | 133 if (!alternative_service_vector.empty()) { |
| 134 // TODO(bnc): Pass on multiple alternative services to Job. | 134 // TODO(bnc): Pass on multiple alternative services to Job. |
| 135 alternative_service = alternative_service_vector[0]; | 135 alternative_service = alternative_service_vector[0]; |
| 136 if (session_->params().disable_preconnects && |
| 137 alternative_service.protocol == QUIC && |
| 138 session_->quic_stream_factory()->IsQuicDoingZeroRTT( |
| 139 alternative_service.host_port_pair(), request_info.privacy_mode)) { |
| 140 return; |
| 141 } |
| 136 } | 142 } |
| 137 | 143 |
| 138 // Due to how the socket pools handle priorities and idle sockets, only IDLE | 144 // Due to how the socket pools handle priorities and idle sockets, only IDLE |
| 139 // priority currently makes sense for preconnects. The priority for | 145 // priority currently makes sense for preconnects. The priority for |
| 140 // preconnects is currently ignored (see RequestSocketsForPool()), but could | 146 // preconnects is currently ignored (see RequestSocketsForPool()), but could |
| 141 // be used at some point for proxy resolution or something. | 147 // be used at some point for proxy resolution or something. |
| 142 Job* job = | 148 Job* job = |
| 143 new Job(this, session_, request_info, IDLE, server_ssl_config, | 149 new Job(this, session_, request_info, IDLE, server_ssl_config, |
| 144 proxy_ssl_config, alternative_service, session_->net_log()); | 150 proxy_ssl_config, alternative_service, session_->net_log()); |
| 145 preconnect_job_set_.insert(job); | 151 preconnect_job_set_.insert(job); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 continue; | 210 continue; |
| 205 } | 211 } |
| 206 | 212 |
| 207 DCHECK_EQ(QUIC, alternative_service.protocol); | 213 DCHECK_EQ(QUIC, alternative_service.protocol); |
| 208 if (!session_->params().enable_quic) | 214 if (!session_->params().enable_quic) |
| 209 continue; | 215 continue; |
| 210 | 216 |
| 211 if (session_->quic_stream_factory()->IsQuicDisabled(origin.port())) | 217 if (session_->quic_stream_factory()->IsQuicDisabled(origin.port())) |
| 212 continue; | 218 continue; |
| 213 | 219 |
| 214 if (!original_url.SchemeIs("https")) { | 220 if (!original_url.SchemeIs("https")) |
| 215 continue; | 221 continue; |
| 216 } | |
| 217 | 222 |
| 218 enabled_alternative_service_vector.push_back(alternative_service); | 223 enabled_alternative_service_vector.push_back(alternative_service); |
| 219 } | 224 } |
| 220 return enabled_alternative_service_vector; | 225 return enabled_alternative_service_vector; |
| 221 } | 226 } |
| 222 | 227 |
| 223 void HttpStreamFactoryImpl::OrphanJob(Job* job, const Request* request) { | 228 void HttpStreamFactoryImpl::OrphanJob(Job* job, const Request* request) { |
| 224 DCHECK(ContainsKey(request_map_, job)); | 229 DCHECK(ContainsKey(request_map_, job)); |
| 225 DCHECK_EQ(request_map_[job], request); | 230 DCHECK_EQ(request_map_[job], request); |
| 226 DCHECK(!ContainsKey(orphaned_job_set_, job)); | 231 DCHECK(!ContainsKey(orphaned_job_set_, job)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 delete job; | 281 delete job; |
| 277 } | 282 } |
| 278 | 283 |
| 279 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { | 284 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { |
| 280 preconnect_job_set_.erase(job); | 285 preconnect_job_set_.erase(job); |
| 281 delete job; | 286 delete job; |
| 282 OnPreconnectsCompleteInternal(); | 287 OnPreconnectsCompleteInternal(); |
| 283 } | 288 } |
| 284 | 289 |
| 285 } // namespace net | 290 } // namespace net |
| OLD | NEW |