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

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: Fix merge 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_job.h ('k') | net/http/http_stream_factory_impl_unittest.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 <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 job_status_(STATUS_RUNNING), 109 job_status_(STATUS_RUNNING),
112 other_job_status_(STATUS_RUNNING), 110 other_job_status_(STATUS_RUNNING),
113 ptr_factory_(this) { 111 ptr_factory_(this) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const { 291 bool HttpStreamFactoryImpl::Job::CanUseExistingSpdySession() const {
294 // We need to make sure that if a spdy session was created for 292 // We need to make sure that if a spdy session was created for
295 // https://somehost/ that we don't use that session for http://somehost:443/. 293 // https://somehost/ that we don't use that session for http://somehost:443/.
296 // The only time we can use an existing session is if the request URL is 294 // The only time we can use an existing session is if the request URL is
297 // https (the normal case) or if we're connection to a SPDY proxy, or 295 // https (the normal case) or if we're connection to a SPDY proxy, or
298 // if we're running with force_spdy_always_. crbug.com/133176 296 // if we're running with force_spdy_always_. crbug.com/133176
299 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is 297 // TODO(ricea): Add "wss" back to this list when SPDY WebSocket support is
300 // working. 298 // working.
301 return request_info_.url.SchemeIs("https") || 299 return request_info_.url.SchemeIs("https") ||
302 proxy_info_.proxy_server().is_https() || 300 proxy_info_.proxy_server().is_https() ||
303 force_spdy_always_; 301 session_->params().force_spdy_always;
304 } 302 }
305 303
306 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() { 304 void HttpStreamFactoryImpl::Job::OnStreamReadyCallback() {
307 DCHECK(stream_.get()); 305 DCHECK(stream_.get());
308 DCHECK(!IsPreconnecting()); 306 DCHECK(!IsPreconnecting());
309 DCHECK(!stream_factory_->for_websockets_); 307 DCHECK(!stream_factory_->for_websockets_);
310 if (IsOrphaned()) { 308 if (IsOrphaned()) {
311 stream_factory_->OnOrphanedJobComplete(this); 309 stream_factory_->OnOrphanedJobComplete(this);
312 } else { 310 } else {
313 request_->Complete(was_npn_negotiated(), 311 request_->Complete(was_npn_negotiated(),
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 } 695 }
698 696
699 if (blocking_job_) 697 if (blocking_job_)
700 next_state_ = STATE_WAIT_FOR_JOB; 698 next_state_ = STATE_WAIT_FOR_JOB;
701 else 699 else
702 next_state_ = STATE_INIT_CONNECTION; 700 next_state_ = STATE_INIT_CONNECTION;
703 return OK; 701 return OK;
704 } 702 }
705 703
706 bool HttpStreamFactoryImpl::Job::ShouldForceSpdySSL() const { 704 bool HttpStreamFactoryImpl::Job::ShouldForceSpdySSL() const {
707 bool rv = force_spdy_always_ && force_spdy_over_ssl_; 705 bool rv = session_->params().force_spdy_always &&
708 return rv && !HttpStreamFactory::HasSpdyExclusion(origin_); 706 session_->params().force_spdy_over_ssl;
707 return rv && !session_->HasSpdyExclusion(origin_);
709 } 708 }
710 709
711 bool HttpStreamFactoryImpl::Job::ShouldForceSpdyWithoutSSL() const { 710 bool HttpStreamFactoryImpl::Job::ShouldForceSpdyWithoutSSL() const {
712 bool rv = force_spdy_always_ && !force_spdy_over_ssl_; 711 bool rv = session_->params().force_spdy_always &&
713 return rv && !HttpStreamFactory::HasSpdyExclusion(origin_); 712 !session_->params().force_spdy_over_ssl;
713 return rv && !session_->HasSpdyExclusion(origin_);
714 } 714 }
715 715
716 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const { 716 bool HttpStreamFactoryImpl::Job::ShouldForceQuic() const {
717 return session_->params().enable_quic && 717 return session_->params().enable_quic &&
718 session_->params().origin_to_force_quic_on.Equals(origin_) && 718 session_->params().origin_to_force_quic_on.Equals(origin_) &&
719 proxy_info_.is_direct(); 719 proxy_info_.is_direct();
720 } 720 }
721 721
722 int HttpStreamFactoryImpl::Job::DoWaitForJob() { 722 int HttpStreamFactoryImpl::Job::DoWaitForJob() {
723 DCHECK(blocking_job_); 723 DCHECK(blocking_job_);
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 1538
1539 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) { 1539 if (job_status_ == STATUS_SUCCEEDED && other_job_status_ == STATUS_BROKEN) {
1540 HistogramBrokenAlternateProtocolLocation( 1540 HistogramBrokenAlternateProtocolLocation(
1541 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN); 1541 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_MAIN);
1542 session_->http_server_properties()->SetBrokenAlternateProtocol( 1542 session_->http_server_properties()->SetBrokenAlternateProtocol(
1543 HostPortPair::FromURL(request_info_.url)); 1543 HostPortPair::FromURL(request_info_.url));
1544 } 1544 }
1545 } 1545 }
1546 1546
1547 } // namespace net 1547 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.h ('k') | net/http/http_stream_factory_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698