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

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

Issue 10834215: Remove static variables from HttpStreamFactory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 8 years, 3 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.cc ('k') | net/socket/client_socket_pool_manager.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_job.h" 5 #include "net/http/http_stream_factory_impl_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 CHECK_EQ(STATE_NONE, next_state_); 554 CHECK_EQ(STATE_NONE, next_state_);
555 next_state_ = STATE_START; 555 next_state_ = STATE_START;
556 int rv = RunLoop(OK); 556 int rv = RunLoop(OK);
557 DCHECK_EQ(ERR_IO_PENDING, rv); 557 DCHECK_EQ(ERR_IO_PENDING, rv);
558 return rv; 558 return rv;
559 } 559 }
560 560
561 int HttpStreamFactoryImpl::Job::DoStart() { 561 int HttpStreamFactoryImpl::Job::DoStart() {
562 int port = request_info_.url.EffectiveIntPort(); 562 int port = request_info_.url.EffectiveIntPort();
563 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port); 563 origin_ = HostPortPair(request_info_.url.HostNoBrackets(), port);
564 origin_url_ = HttpStreamFactory::ApplyHostMappingRules( 564 origin_url_ = stream_factory_->ApplyHostMappingRules(
565 request_info_.url, &origin_); 565 request_info_.url, &origin_);
566 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_)); 566 http_pipelining_key_.reset(new HttpPipelinedHost::Key(origin_));
567 567
568 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB, 568 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_JOB,
569 base::Bind(&NetLogHttpStreamJobCallback, 569 base::Bind(&NetLogHttpStreamJobCallback,
570 &request_info_.url, &origin_url_)); 570 &request_info_.url, &origin_url_));
571 571
572 // Don't connect to restricted ports. 572 // Don't connect to restricted ports.
573 if (!IsPortAllowedByDefault(port) && !IsPortAllowedByOverride(port)) { 573 if (!IsPortAllowedByDefault(port) && !IsPortAllowedByOverride(port)) {
574 if (waiting_job_) { 574 if (waiting_job_) {
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
1199 // happen, unless this code is used inside sandbox. 1199 // happen, unless this code is used inside sandbox.
1200 if (ssl_info_.cert == NULL || 1200 if (ssl_info_.cert == NULL ||
1201 !X509Certificate::GetDEREncoded(ssl_info_.cert->os_cert_handle(), 1201 !X509Certificate::GetDEREncoded(ssl_info_.cert->os_cert_handle(),
1202 &bad_cert.der_cert)) { 1202 &bad_cert.der_cert)) {
1203 return error; 1203 return error;
1204 } 1204 }
1205 bad_cert.cert_status = ssl_info_.cert_status; 1205 bad_cert.cert_status = ssl_info_.cert_status;
1206 server_ssl_config_.allowed_bad_certs.push_back(bad_cert); 1206 server_ssl_config_.allowed_bad_certs.push_back(bad_cert);
1207 1207
1208 int load_flags = request_info_.load_flags; 1208 int load_flags = request_info_.load_flags;
1209 if (HttpStreamFactory::ignore_certificate_errors()) 1209 if (session_->params().ignore_certificate_errors)
1210 load_flags |= LOAD_IGNORE_ALL_CERT_ERRORS; 1210 load_flags |= LOAD_IGNORE_ALL_CERT_ERRORS;
1211 if (ssl_socket->IgnoreCertError(error, load_flags)) 1211 if (ssl_socket->IgnoreCertError(error, load_flags))
1212 return OK; 1212 return OK;
1213 return error; 1213 return error;
1214 } 1214 }
1215 1215
1216 void HttpStreamFactoryImpl::Job::SwitchToSpdyMode() { 1216 void HttpStreamFactoryImpl::Job::SwitchToSpdyMode() {
1217 if (HttpStreamFactory::spdy_enabled()) 1217 if (HttpStreamFactory::spdy_enabled())
1218 using_spdy_ = true; 1218 using_spdy_ = true;
1219 } 1219 }
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 return !IsPreconnecting() && !request_; 1261 return !IsPreconnecting() && !request_;
1262 } 1262 }
1263 1263
1264 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() { 1264 bool HttpStreamFactoryImpl::Job::IsRequestEligibleForPipelining() {
1265 if (IsPreconnecting() || !request_) { 1265 if (IsPreconnecting() || !request_) {
1266 return false; 1266 return false;
1267 } 1267 }
1268 if (session_->force_http_pipelining()) { 1268 if (session_->force_http_pipelining()) {
1269 return true; 1269 return true;
1270 } 1270 }
1271 if (!HttpStreamFactory::http_pipelining_enabled()) { 1271 if (!session_->params().http_pipelining_enabled) {
1272 return false; 1272 return false;
1273 } 1273 }
1274 if (using_ssl_) { 1274 if (using_ssl_) {
1275 return false; 1275 return false;
1276 } 1276 }
1277 if (request_info_.method != "GET" && request_info_.method != "HEAD") { 1277 if (request_info_.method != "GET" && request_info_.method != "HEAD") {
1278 return false; 1278 return false;
1279 } 1279 }
1280 if (request_info_.load_flags & 1280 if (request_info_.load_flags &
1281 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | 1281 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH |
1282 net::LOAD_IS_DOWNLOAD)) { 1282 net::LOAD_IS_DOWNLOAD)) {
1283 // Avoid pipelining resources that may be streamed for a long time. 1283 // Avoid pipelining resources that may be streamed for a long time.
1284 return false; 1284 return false;
1285 } 1285 }
1286 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( 1286 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining(
1287 *http_pipelining_key_.get()); 1287 *http_pipelining_key_.get());
1288 } 1288 }
1289 1289
1290 } // namespace net 1290 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | net/socket/client_socket_pool_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698