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

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

Issue 275953002: Remove HTTP pipelining support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix line endings Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_job.h » ('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 "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "net/base/net_log.h" 12 #include "net/base/net_log.h"
13 #include "net/base/net_util.h" 13 #include "net/base/net_util.h"
14 #include "net/http/http_network_session.h" 14 #include "net/http/http_network_session.h"
15 #include "net/http/http_pipelined_connection.h"
16 #include "net/http/http_pipelined_host.h"
17 #include "net/http/http_pipelined_stream.h"
18 #include "net/http/http_server_properties.h" 15 #include "net/http/http_server_properties.h"
19 #include "net/http/http_stream_factory_impl_job.h" 16 #include "net/http/http_stream_factory_impl_job.h"
20 #include "net/http/http_stream_factory_impl_request.h" 17 #include "net/http/http_stream_factory_impl_request.h"
21 #include "net/spdy/spdy_http_stream.h" 18 #include "net/spdy/spdy_http_stream.h"
22 #include "url/gurl.h" 19 #include "url/gurl.h"
23 20
24 namespace net { 21 namespace net {
25 22
26 namespace { 23 namespace {
27 24
(...skipping 10 matching lines...) Expand all
38 replacements.SetSchemeStr(new_scheme); 35 replacements.SetSchemeStr(new_scheme);
39 replacements.SetPortStr(new_port); 36 replacements.SetPortStr(new_port);
40 return original_url.ReplaceComponents(replacements); 37 return original_url.ReplaceComponents(replacements);
41 } 38 }
42 39
43 } // namespace 40 } // namespace
44 41
45 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, 42 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
46 bool for_websockets) 43 bool for_websockets)
47 : session_(session), 44 : session_(session),
48 http_pipelined_host_pool_(this, NULL,
49 session_->http_server_properties(),
50 session_->force_http_pipelining()),
51 for_websockets_(for_websockets) {} 45 for_websockets_(for_websockets) {}
52 46
53 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { 47 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
54 DCHECK(request_map_.empty()); 48 DCHECK(request_map_.empty());
55 DCHECK(spdy_session_request_map_.empty()); 49 DCHECK(spdy_session_request_map_.empty());
56 DCHECK(http_pipelining_request_map_.empty());
57 50
58 std::set<const Job*> tmp_job_set; 51 std::set<const Job*> tmp_job_set;
59 tmp_job_set.swap(orphaned_job_set_); 52 tmp_job_set.swap(orphaned_job_set_);
60 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end()); 53 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end());
61 DCHECK(orphaned_job_set_.empty()); 54 DCHECK(orphaned_job_set_.empty());
62 55
63 tmp_job_set.clear(); 56 tmp_job_set.clear();
64 tmp_job_set.swap(preconnect_job_set_); 57 tmp_job_set.swap(preconnect_job_set_);
65 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end()); 58 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end());
66 DCHECK(preconnect_job_set_.empty()); 59 DCHECK(preconnect_job_set_.empty());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 server_ssl_config, proxy_ssl_config, session_->net_log()); 165 server_ssl_config, proxy_ssl_config, session_->net_log());
173 job->MarkAsAlternate(request_info.url, alternate); 166 job->MarkAsAlternate(request_info.url, alternate);
174 } else { 167 } else {
175 job = new Job(this, session_, request_info, priority, 168 job = new Job(this, session_, request_info, priority,
176 server_ssl_config, proxy_ssl_config, session_->net_log()); 169 server_ssl_config, proxy_ssl_config, session_->net_log());
177 } 170 }
178 preconnect_job_set_.insert(job); 171 preconnect_job_set_.insert(job);
179 job->Preconnect(num_streams); 172 job->Preconnect(num_streams);
180 } 173 }
181 174
182 base::Value* HttpStreamFactoryImpl::PipelineInfoToValue() const {
183 return http_pipelined_host_pool_.PipelineInfoToValue();
184 }
185
186 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { 175 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
187 return session_->params().host_mapping_rules; 176 return session_->params().host_mapping_rules;
188 } 177 }
189 178
190 PortAlternateProtocolPair HttpStreamFactoryImpl::GetAlternateProtocolRequestFor( 179 PortAlternateProtocolPair HttpStreamFactoryImpl::GetAlternateProtocolRequestFor(
191 const GURL& original_url, 180 const GURL& original_url,
192 GURL* alternate_url) { 181 GURL* alternate_url) {
193 if (!session_->params().use_alternate_protocols) 182 if (!session_->params().use_alternate_protocols)
194 return kNoAlternateProtocol; 183 return kNoAlternateProtocol;
195 184
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 orphaned_job_set_.erase(job); 303 orphaned_job_set_.erase(job);
315 delete job; 304 delete job;
316 } 305 }
317 306
318 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 307 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
319 preconnect_job_set_.erase(job); 308 preconnect_job_set_.erase(job);
320 delete job; 309 delete job;
321 OnPreconnectsCompleteInternal(); 310 OnPreconnectsCompleteInternal();
322 } 311 }
323 312
324 void HttpStreamFactoryImpl::OnHttpPipelinedHostHasAdditionalCapacity(
325 HttpPipelinedHost* host) {
326 while (ContainsKey(http_pipelining_request_map_, host->GetKey())) {
327 HttpPipelinedStream* stream =
328 http_pipelined_host_pool_.CreateStreamOnExistingPipeline(
329 host->GetKey());
330 if (!stream) {
331 break;
332 }
333
334 Request* request = *http_pipelining_request_map_[host->GetKey()].begin();
335 request->Complete(stream->was_npn_negotiated(),
336 stream->protocol_negotiated(),
337 false, // not using_spdy
338 stream->net_log());
339 request->OnStreamReady(NULL,
340 stream->used_ssl_config(),
341 stream->used_proxy_info(),
342 stream);
343 }
344 }
345
346 void HttpStreamFactoryImpl::AbortPipelinedRequestsWithKey(
347 const Job* job, const HttpPipelinedHost::Key& key, int status,
348 const SSLConfig& used_ssl_config) {
349 RequestVector requests_to_fail = http_pipelining_request_map_[key];
350 for (RequestVector::const_iterator it = requests_to_fail.begin();
351 it != requests_to_fail.end(); ++it) {
352 Request* request = *it;
353 if (request == request_map_[job]) {
354 continue;
355 }
356 request->OnStreamFailed(NULL, status, used_ssl_config);
357 }
358 }
359
360 } // namespace net 313 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.h ('k') | net/http/http_stream_factory_impl_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698