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

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

Issue 871753006: Add AlternateProtocolInfo to HttpStreamFactoryImpl::Job. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
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"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 GURL alternate_url; 109 GURL alternate_url;
110 AlternateProtocolInfo alternate = 110 AlternateProtocolInfo alternate =
111 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); 111 GetAlternateProtocolRequestFor(request_info.url, &alternate_url);
112 Job* alternate_job = NULL; 112 Job* alternate_job = NULL;
113 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { 113 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) {
114 // Never share connection with other jobs for FTP requests. 114 // Never share connection with other jobs for FTP requests.
115 DCHECK(!request_info.url.SchemeIs("ftp")); 115 DCHECK(!request_info.url.SchemeIs("ftp"));
116 116
117 HttpRequestInfo alternate_request_info = request_info; 117 HttpRequestInfo alternate_request_info = request_info;
118 alternate_request_info.url = alternate_url; 118 alternate_request_info.url = alternate_url;
119 alternate_job = 119 alternate_job = new Job(this, session_, alternate_request_info, priority,
120 new Job(this, session_, alternate_request_info, priority, 120 server_ssl_config, proxy_ssl_config,
121 server_ssl_config, proxy_ssl_config, net_log.net_log()); 121 net_log.net_log(), alternate);
122 request->AttachJob(alternate_job); 122 request->AttachJob(alternate_job);
123 alternate_job->MarkAsAlternate(request_info.url, alternate); 123 alternate_job->MarkAsAlternate(request_info.url);
124 } 124 }
125 125
126 Job* job = new Job(this, session_, request_info, priority, 126 Job* job = new Job(this, session_, request_info, priority, server_ssl_config,
127 server_ssl_config, proxy_ssl_config, net_log.net_log()); 127 proxy_ssl_config, net_log.net_log(), alternate);
128 request->AttachJob(job); 128 request->AttachJob(job);
129 if (alternate_job) { 129 if (alternate_job) {
130 // Never share connection with other jobs for FTP requests. 130 // Never share connection with other jobs for FTP requests.
131 DCHECK(!request_info.url.SchemeIs("ftp")); 131 DCHECK(!request_info.url.SchemeIs("ftp"));
132 132
133 job->WaitFor(alternate_job); 133 job->WaitFor(alternate_job);
134 // Make sure to wait until we call WaitFor(), before starting 134 // Make sure to wait until we call WaitFor(), before starting
135 // |alternate_job|, otherwise |alternate_job| will not notify |job| 135 // |alternate_job|, otherwise |alternate_job| will not notify |job|
136 // appropriately. 136 // appropriately.
137 alternate_job->Start(request); 137 alternate_job->Start(request);
(...skipping 13 matching lines...) Expand all
151 const SSLConfig& proxy_ssl_config) { 151 const SSLConfig& proxy_ssl_config) {
152 DCHECK(!for_websockets_); 152 DCHECK(!for_websockets_);
153 GURL alternate_url; 153 GURL alternate_url;
154 AlternateProtocolInfo alternate = 154 AlternateProtocolInfo alternate =
155 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); 155 GetAlternateProtocolRequestFor(request_info.url, &alternate_url);
156 Job* job = NULL; 156 Job* job = NULL;
157 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) { 157 if (alternate.protocol != UNINITIALIZED_ALTERNATE_PROTOCOL) {
158 HttpRequestInfo alternate_request_info = request_info; 158 HttpRequestInfo alternate_request_info = request_info;
159 alternate_request_info.url = alternate_url; 159 alternate_request_info.url = alternate_url;
160 job = new Job(this, session_, alternate_request_info, priority, 160 job = new Job(this, session_, alternate_request_info, priority,
161 server_ssl_config, proxy_ssl_config, session_->net_log()); 161 server_ssl_config, proxy_ssl_config, session_->net_log(),
162 job->MarkAsAlternate(request_info.url, alternate); 162 alternate);
163 job->MarkAsAlternate(request_info.url);
163 } else { 164 } else {
164 job = new Job(this, session_, request_info, priority, 165 job = new Job(this, session_, request_info, priority, server_ssl_config,
165 server_ssl_config, proxy_ssl_config, session_->net_log()); 166 proxy_ssl_config, session_->net_log(), alternate);
166 } 167 }
167 preconnect_job_set_.insert(job); 168 preconnect_job_set_.insert(job);
168 job->Preconnect(num_streams); 169 job->Preconnect(num_streams);
169 } 170 }
170 171
171 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { 172 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
172 return session_->params().host_mapping_rules; 173 return session_->params().host_mapping_rules;
173 } 174 }
174 175
175 AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor( 176 AlternateProtocolInfo HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 delete job; 299 delete job;
299 } 300 }
300 301
301 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 302 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
302 preconnect_job_set_.erase(job); 303 preconnect_job_set_.erase(job);
303 delete job; 304 delete job;
304 OnPreconnectsCompleteInternal(); 305 OnPreconnectsCompleteInternal();
305 } 306 }
306 307
307 } // namespace net 308 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698