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

Side by Side Diff: net/http/http_network_session.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_network_session.h ('k') | net/http/http_network_transaction.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_network_session.h" 5 #include "net/http/http_network_session.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 testing_fixed_http_port(0), 73 testing_fixed_http_port(0),
74 testing_fixed_https_port(0), 74 testing_fixed_https_port(0),
75 force_spdy_single_domain(false), 75 force_spdy_single_domain(false),
76 enable_spdy_compression(true), 76 enable_spdy_compression(true),
77 enable_spdy_ping_based_connection_checking(true), 77 enable_spdy_ping_based_connection_checking(true),
78 spdy_default_protocol(kProtoUnknown), 78 spdy_default_protocol(kProtoUnknown),
79 spdy_stream_initial_recv_window_size(0), 79 spdy_stream_initial_recv_window_size(0),
80 spdy_initial_max_concurrent_streams(0), 80 spdy_initial_max_concurrent_streams(0),
81 spdy_max_concurrent_streams_limit(0), 81 spdy_max_concurrent_streams_limit(0),
82 time_func(&base::TimeTicks::Now), 82 time_func(&base::TimeTicks::Now),
83 force_spdy_over_ssl(true),
84 force_spdy_always(false),
85 use_alternate_protocols(false),
83 enable_quic(false), 86 enable_quic(false),
84 enable_quic_https(false), 87 enable_quic_https(false),
85 enable_quic_port_selection(true), 88 enable_quic_port_selection(true),
86 enable_quic_pacing(false), 89 enable_quic_pacing(false),
87 enable_quic_time_based_loss_detection(false), 90 enable_quic_time_based_loss_detection(false),
88 enable_quic_persist_server_info(false), 91 enable_quic_persist_server_info(false),
89 quic_clock(NULL), 92 quic_clock(NULL),
90 quic_random(NULL), 93 quic_random(NULL),
91 quic_max_packet_length(kDefaultMaxPacketSize), 94 quic_max_packet_length(kDefaultMaxPacketSize),
92 enable_user_alternate_protocol_ports(false), 95 enable_user_alternate_protocol_ports(false),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 params.time_func, 142 params.time_func,
140 params.trusted_spdy_proxy), 143 params.trusted_spdy_proxy),
141 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), 144 http_stream_factory_(new HttpStreamFactoryImpl(this, false)),
142 http_stream_factory_for_websocket_( 145 http_stream_factory_for_websocket_(
143 new HttpStreamFactoryImpl(this, true)), 146 new HttpStreamFactoryImpl(this, true)),
144 params_(params) { 147 params_(params) {
145 DCHECK(proxy_service_); 148 DCHECK(proxy_service_);
146 DCHECK(ssl_config_service_.get()); 149 DCHECK(ssl_config_service_.get());
147 CHECK(http_server_properties_); 150 CHECK(http_server_properties_);
148 151
152 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION;
153 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) {
154 enabled_protocols_[i - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] = false;
155 }
156
157 // TODO(rtenneti): bug 116575 - consider combining the NextProto and
158 // AlternateProtocol.
159 for (std::vector<NextProto>::const_iterator it = params_.next_protos.begin();
160 it != params_.next_protos.end(); ++it) {
161 NextProto proto = *it;
162
163 // Add the protocol to the TLS next protocol list, except for QUIC
164 // since it uses UDP.
165 if (proto != kProtoQUIC1SPDY3) {
166 next_protos_.push_back(SSLClientSocket::NextProtoToString(proto));
167 }
168
169 // Enable the corresponding alternate protocol, except for HTTP
170 // which has not corresponding alternative.
171 if (proto != kProtoHTTP11) {
172 AlternateProtocol alternate = AlternateProtocolFromNextProto(proto);
173 if (!IsAlternateProtocolValid(alternate)) {
174 NOTREACHED() << "Invalid next proto: " << proto;
175 continue;
176 }
177 enabled_protocols_[alternate - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] =
178 true;
179 }
180 }
181
149 if (HpackHuffmanAggregator::UseAggregator()) { 182 if (HpackHuffmanAggregator::UseAggregator()) {
150 huffman_aggregator_.reset(new HpackHuffmanAggregator()); 183 huffman_aggregator_.reset(new HpackHuffmanAggregator());
151 } 184 }
152 } 185 }
153 186
154 HttpNetworkSession::~HttpNetworkSession() { 187 HttpNetworkSession::~HttpNetworkSession() {
155 STLDeleteElements(&response_drainers_); 188 STLDeleteElements(&response_drainers_);
156 spdy_session_pool_.CloseAllSessions(); 189 spdy_session_pool_.CloseAllSessions();
157 } 190 }
158 191
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED); 263 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED);
231 quic_stream_factory_.CloseAllSessions(ERR_ABORTED); 264 quic_stream_factory_.CloseAllSessions(ERR_ABORTED);
232 } 265 }
233 266
234 void HttpNetworkSession::CloseIdleConnections() { 267 void HttpNetworkSession::CloseIdleConnections() {
235 normal_socket_pool_manager_->CloseIdleSockets(); 268 normal_socket_pool_manager_->CloseIdleSockets();
236 websocket_socket_pool_manager_->CloseIdleSockets(); 269 websocket_socket_pool_manager_->CloseIdleSockets();
237 spdy_session_pool_.CloseCurrentIdleSessions(); 270 spdy_session_pool_.CloseCurrentIdleSessions();
238 } 271 }
239 272
273 bool HttpNetworkSession::IsProtocolEnabled(AlternateProtocol protocol) const {
274 DCHECK(IsAlternateProtocolValid(protocol));
275 return enabled_protocols_[
276 protocol - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION];
277 }
278
279 void HttpNetworkSession::GetNextProtos(
280 std::vector<std::string>* next_protos) const {
281 if (HttpStreamFactory::spdy_enabled()) {
282 *next_protos = next_protos_;
283 } else {
284 next_protos->clear();
285 }
286 }
287
288 bool HttpNetworkSession::HasSpdyExclusion(
289 HostPortPair host_port_pair) const {
290 return params_.forced_spdy_exclusions.find(host_port_pair) !=
291 params_.forced_spdy_exclusions.end();
292 }
293
240 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( 294 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager(
241 SocketPoolType pool_type) { 295 SocketPoolType pool_type) {
242 switch (pool_type) { 296 switch (pool_type) {
243 case NORMAL_SOCKET_POOL: 297 case NORMAL_SOCKET_POOL:
244 return normal_socket_pool_manager_.get(); 298 return normal_socket_pool_manager_.get();
245 case WEBSOCKET_SOCKET_POOL: 299 case WEBSOCKET_SOCKET_POOL:
246 return websocket_socket_pool_manager_.get(); 300 return websocket_socket_pool_manager_.get();
247 default: 301 default:
248 NOTREACHED(); 302 NOTREACHED();
249 break; 303 break;
250 } 304 }
251 return NULL; 305 return NULL;
252 } 306 }
253 307
254 } // namespace net 308 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698