Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: net/http/http_stream_factory_impl.cc

Issue 1502453003: QUIC - Disable Preconnect when QUIC can be spoken to a server with 0RTT (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test name Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "net/base/net_util.h" 11 #include "net/base/net_util.h"
12 #include "net/http/http_network_session.h" 12 #include "net/http/http_network_session.h"
13 #include "net/http/http_server_properties.h" 13 #include "net/http/http_server_properties.h"
14 #include "net/http/http_stream_factory_impl_job.h" 14 #include "net/http/http_stream_factory_impl_job.h"
15 #include "net/http/http_stream_factory_impl_request.h" 15 #include "net/http/http_stream_factory_impl_request.h"
16 #include "net/log/net_log.h" 16 #include "net/log/net_log.h"
17 #include "net/quic/quic_server_id.h"
17 #include "net/spdy/spdy_http_stream.h" 18 #include "net/spdy/spdy_http_stream.h"
18 #include "url/gurl.h" 19 #include "url/gurl.h"
19 20
20 namespace net { 21 namespace net {
21 22
22 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, 23 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
23 bool for_websockets) 24 bool for_websockets)
24 : session_(session), 25 : session_(session),
25 for_websockets_(for_websockets) {} 26 for_websockets_(for_websockets) {}
26 27
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 const HttpRequestInfo& request_info, 127 const HttpRequestInfo& request_info,
127 const SSLConfig& server_ssl_config, 128 const SSLConfig& server_ssl_config,
128 const SSLConfig& proxy_ssl_config) { 129 const SSLConfig& proxy_ssl_config) {
129 DCHECK(!for_websockets_); 130 DCHECK(!for_websockets_);
130 AlternativeService alternative_service; 131 AlternativeService alternative_service;
131 AlternativeServiceVector alternative_service_vector = 132 AlternativeServiceVector alternative_service_vector =
132 GetAlternativeServicesFor(request_info.url); 133 GetAlternativeServicesFor(request_info.url);
133 if (!alternative_service_vector.empty()) { 134 if (!alternative_service_vector.empty()) {
134 // TODO(bnc): Pass on multiple alternative services to Job. 135 // TODO(bnc): Pass on multiple alternative services to Job.
135 alternative_service = alternative_service_vector[0]; 136 alternative_service = alternative_service_vector[0];
137 if (session_->params().quic_disable_preconnect_if_0rtt &&
138 alternative_service.protocol == QUIC &&
139 session_->quic_stream_factory()->ZeroRTTEnabledFor(QuicServerId(
140 alternative_service.host_port_pair(), request_info.privacy_mode))) {
141 return;
142 }
136 } 143 }
137 144
138 // Due to how the socket pools handle priorities and idle sockets, only IDLE 145 // Due to how the socket pools handle priorities and idle sockets, only IDLE
139 // priority currently makes sense for preconnects. The priority for 146 // priority currently makes sense for preconnects. The priority for
140 // preconnects is currently ignored (see RequestSocketsForPool()), but could 147 // preconnects is currently ignored (see RequestSocketsForPool()), but could
141 // be used at some point for proxy resolution or something. 148 // be used at some point for proxy resolution or something.
142 Job* job = 149 Job* job =
143 new Job(this, session_, request_info, IDLE, server_ssl_config, 150 new Job(this, session_, request_info, IDLE, server_ssl_config,
144 proxy_ssl_config, alternative_service, session_->net_log()); 151 proxy_ssl_config, alternative_service, session_->net_log());
145 preconnect_job_set_.insert(job); 152 preconnect_job_set_.insert(job);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 continue; 211 continue;
205 } 212 }
206 213
207 DCHECK_EQ(QUIC, alternative_service.protocol); 214 DCHECK_EQ(QUIC, alternative_service.protocol);
208 if (!session_->params().enable_quic) 215 if (!session_->params().enable_quic)
209 continue; 216 continue;
210 217
211 if (session_->quic_stream_factory()->IsQuicDisabled(origin.port())) 218 if (session_->quic_stream_factory()->IsQuicDisabled(origin.port()))
212 continue; 219 continue;
213 220
214 if (!original_url.SchemeIs("https")) { 221 if (!original_url.SchemeIs("https"))
215 continue; 222 continue;
216 }
217 223
218 enabled_alternative_service_vector.push_back(alternative_service); 224 enabled_alternative_service_vector.push_back(alternative_service);
219 } 225 }
220 return enabled_alternative_service_vector; 226 return enabled_alternative_service_vector;
221 } 227 }
222 228
223 void HttpStreamFactoryImpl::OrphanJob(Job* job, const Request* request) { 229 void HttpStreamFactoryImpl::OrphanJob(Job* job, const Request* request) {
224 DCHECK(ContainsKey(request_map_, job)); 230 DCHECK(ContainsKey(request_map_, job));
225 DCHECK_EQ(request_map_[job], request); 231 DCHECK_EQ(request_map_[job], request);
226 DCHECK(!ContainsKey(orphaned_job_set_, job)); 232 DCHECK(!ContainsKey(orphaned_job_set_, job));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 delete job; 282 delete job;
277 } 283 }
278 284
279 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 285 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
280 preconnect_job_set_.erase(job); 286 preconnect_job_set_.erase(job);
281 delete job; 287 delete job;
282 OnPreconnectsCompleteInternal(); 288 OnPreconnectsCompleteInternal();
283 } 289 }
284 290
285 } // namespace net 291 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698