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

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

Issue 284423002: Remove HttpStreamFactory's NPN/SPDY globals, except for spdy_enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move lineabreak 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
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 <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 stream_factory_(stream_factory), 92 stream_factory_(stream_factory),
93 next_state_(STATE_NONE), 93 next_state_(STATE_NONE),
94 pac_request_(NULL), 94 pac_request_(NULL),
95 blocking_job_(NULL), 95 blocking_job_(NULL),
96 waiting_job_(NULL), 96 waiting_job_(NULL),
97 using_ssl_(false), 97 using_ssl_(false),
98 using_spdy_(false), 98 using_spdy_(false),
99 using_quic_(false), 99 using_quic_(false),
100 quic_request_(session_->quic_stream_factory()), 100 quic_request_(session_->quic_stream_factory()),
101 using_existing_quic_session_(false), 101 using_existing_quic_session_(false),
102 force_spdy_always_(HttpStreamFactory::force_spdy_always()),
103 force_spdy_over_ssl_(HttpStreamFactory::force_spdy_over_ssl()),
104 spdy_certificate_error_(OK), 102 spdy_certificate_error_(OK),
105 establishing_tunnel_(false), 103 establishing_tunnel_(false),
106 was_npn_negotiated_(false), 104 was_npn_negotiated_(false),
107 protocol_negotiated_(kProtoUnknown), 105 protocol_negotiated_(kProtoUnknown),
108 num_streams_(0), 106 num_streams_(0),
109 spdy_session_direct_(false), 107 spdy_session_direct_(false),
110 existing_available_pipeline_(false), 108 existing_available_pipeline_(false),
111 ptr_factory_(this) { 109 ptr_factory_(this) {
112 DCHECK(stream_factory); 110 DCHECK(stream_factory);
113 DCHECK(session); 111 DCHECK(session);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { 289 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const {
292 // We need to make sure that if a spdy session was created for 290 // We need to make sure that if a spdy session was created for
293 // https://somehost/ that we don't use that session for http://somehost:443/. 291 // https://somehost/ that we don't use that session for http://somehost:443/.
294 // The only time we can use an existing session is if the request URL is 292 // The only time we can use an existing session is if the request URL is
295 // https (the normal case) or if we're connection to a SPDY proxy, or 293 // https (the normal case) or if we're connection to a SPDY proxy, or
296 // if we're running with force_spdy_always_. crbug.com/133176 294 // if we're running with force_spdy_always_. crbug.com/133176
297 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is 295 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is
298 // working. 296 // working.
299 return request_info_.url.SchemeIs("https") || 297 return request_info_.url.SchemeIs("https") ||
300 proxy_info_.proxy_server().is_https() || 298 proxy_info_.proxy_server().is_https() ||
301 force_spdy_always_; 299 session_->params().force_spdy_always;
302 } 300 }
303 301
304 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { 302 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
305 DCHECK(stream_.get()); 303 DCHECK(stream_.get());
306 DCHECK(!IsPreconnecting()); 304 DCHECK(!IsPreconnecting());
307 DCHECK(!stream_factory_->for_websockets_); 305 DCHECK(!stream_factory_->for_websockets_);
308 if (IsOrphaned()) { 306 if (IsOrphaned()) {
309 stream_factory_->OnOrphanedJobComplete(this); 307 stream_factory_->OnOrphanedJobComplete(this);
310 } else { 308 } else {
311 request_->Complete(was_npn_negotiated(), 309 request_->Complete(was_npn_negotiated(),
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 686 }
689 687
690 if (blocking_job_) 688 if (blocking_job_)
691 next_state_ = STATE_WAIT_FOR_JOB; 689 next_state_ = STATE_WAIT_FOR_JOB;
692 else 690 else
693 next_state_ = STATE_INIT_CONNECTION; 691 next_state_ = STATE_INIT_CONNECTION;
694 return OK; 692 return OK;
695 } 693 }
696 694
697 bool HttpStreamFactoryImpl::Job::ShouldForceSpdySSL() const { 695 bool HttpStreamFactoryImpl::Job::ShouldForceSpdySSL() const {
698 bool rv = force_spdy_always_ && force_spdy_over_ssl_; 696 bool rv = session_->params().force_spdy_always &&
699 return rv && !HttpStreamFactory::HasSpdyExclusion(origin_); 697 session_->params().force_spdy_over_ssl;
698 return rv && !session_->HasSpdyExclusion(origin_);
700 } 699 }
701 700
702 bool HttpStreamFactoryImpl::Job::ShouldForceSpdyWithoutSSL() const { 701 bool HttpStreamFactoryImpl::Job::ShouldForceSpdyWithoutSSL() const {
703 bool rv = force_spdy_always_ && !force_spdy_over_ssl_; 702 bool rv = session_->params().force_spdy_always &&
704 return rv && !HttpStreamFactory::HasSpdyExclusion(origin_); 703 !session_->params().force_spdy_over_ssl;
704 return rv && !session_->HasSpdyExclusion(origin_);
705 } 705 }
706 706
707 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { 707 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const {
708 return session_->params().enable_quic && 708 return session_->params().enable_quic &&
709 session_->params().origin_to_force_quic_on.Equals(origin_) && 709 session_->params().origin_to_force_quic_on.Equals(origin_) &&
710 proxy_info_.is_direct(); 710 proxy_info_.is_direct();
711 } 711 }
712 712
713 int HttpStreamFactoryImpl::Job::DoWaitForJob() { 713 int HttpStreamFactoryImpl::Job::DoWaitForJob() {
714 DCHECK(blocking_job_); 714 DCHECK(blocking_job_);
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after
1493 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH | 1493 (net::LOAD_MAIN_FRAME | net::LOAD_SUB_FRAME | net::LOAD_PREFETCH |
1494 net::LOAD_IS_DOWNLOAD)) { 1494 net::LOAD_IS_DOWNLOAD)) {
1495 // Avoid pipelining resources that may be streamed for a long time. 1495 // Avoid pipelining resources that may be streamed for a long time.
1496 return false; 1496 return false;
1497 } 1497 }
1498 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining( 1498 return stream_factory_->http_pipelined_host_pool_.IsKeyEligibleForPipelining(
1499 *http_pipelining_key_.get()); 1499 *http_pipelining_key_.get());
1500 } 1500 }
1501 1501
1502 } // namespace net 1502 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698