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

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

Issue 9433015: Add a force pipelining option to load flags. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use flag in session params Created 8 years, 9 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 "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "googleurl/src/gurl.h" 9 #include "googleurl/src/gurl.h"
10 #include "net/base/net_log.h" 10 #include "net/base/net_log.h"
(...skipping 20 matching lines...) Expand all
31 replacements.SetSchemeStr(new_scheme); 31 replacements.SetSchemeStr(new_scheme);
32 replacements.SetPortStr(new_port); 32 replacements.SetPortStr(new_port);
33 return original_url.ReplaceComponents(replacements); 33 return original_url.ReplaceComponents(replacements);
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session) 38 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session)
39 : session_(session), 39 : session_(session),
40 http_pipelined_host_pool_(this, NULL, 40 http_pipelined_host_pool_(this, NULL,
41 session_->http_server_properties()) {} 41 session_->http_server_properties(),
42 session_->force_http_pipelining()) {}
42 43
43 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() { 44 HttpStreamFactoryImpl::~HttpStreamFactoryImpl() {
44 DCHECK(request_map_.empty()); 45 DCHECK(request_map_.empty());
45 DCHECK(spdy_session_request_map_.empty()); 46 DCHECK(spdy_session_request_map_.empty());
46 47
47 std::set<const Job*> tmp_job_set; 48 std::set<const Job*> tmp_job_set;
48 tmp_job_set.swap(orphaned_job_set_); 49 tmp_job_set.swap(orphaned_job_set_);
49 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end()); 50 STLDeleteContainerPointers(tmp_job_set.begin(), tmp_job_set.end());
50 DCHECK(orphaned_job_set_.empty()); 51 DCHECK(orphaned_job_set_.empty());
51 52
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 delete job; 226 delete job;
226 } 227 }
227 228
228 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) { 229 void HttpStreamFactoryImpl::OnPreconnectsComplete(const Job* job) {
229 preconnect_job_set_.erase(job); 230 preconnect_job_set_.erase(job);
230 delete job; 231 delete job;
231 OnPreconnectsCompleteInternal(); 232 OnPreconnectsCompleteInternal();
232 } 233 }
233 234
234 void HttpStreamFactoryImpl::OnHttpPipelinedHostHasAdditionalCapacity( 235 void HttpStreamFactoryImpl::OnHttpPipelinedHostHasAdditionalCapacity(
235 const HostPortPair& origin) { 236 HttpPipelinedHost* host) {
236 HttpPipelinedStream* stream; 237 while (ContainsKey(http_pipelining_request_map_, host->GetKey())) {
237 while (ContainsKey(http_pipelining_request_map_, origin) && 238 HttpPipelinedStream* stream =
238 (stream = http_pipelined_host_pool_.CreateStreamOnExistingPipeline( 239 http_pipelined_host_pool_.CreateStreamOnExistingPipeline(
239 origin))) { 240 host->GetKey());
240 Request* request = *http_pipelining_request_map_[origin].begin(); 241 if (!stream) {
242 break;
243 }
244
245 Request* request = *http_pipelining_request_map_[host->GetKey()].begin();
241 request->Complete(stream->was_npn_negotiated(), 246 request->Complete(stream->was_npn_negotiated(),
242 stream->protocol_negotiated(), 247 stream->protocol_negotiated(),
243 false, // not using_spdy 248 false, // not using_spdy
244 stream->net_log()); 249 stream->net_log());
245 request->OnStreamReady(NULL, 250 request->OnStreamReady(NULL,
246 stream->used_ssl_config(), 251 stream->used_ssl_config(),
247 stream->used_proxy_info(), 252 stream->used_proxy_info(),
248 stream); 253 stream);
249 } 254 }
250 } 255 }
251 256
257 void HttpStreamFactoryImpl::AbortPipelinedRequestsWithKey(
258 const Job* job, const HttpPipelinedHost::Key& key, int status,
259 const SSLConfig& used_ssl_config) {
260 RequestSet requests_to_fail = http_pipelining_request_map_[key];
261 requests_to_fail.erase(request_map_[job]);
262 for (RequestSet::const_iterator it = requests_to_fail.begin();
263 it != requests_to_fail.end(); ++it) {
264 Request* request = *it;
265 request->OnStreamFailed(NULL, status, used_ssl_config);
266 }
267 }
268
252 } // namespace net 269 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698