| OLD | NEW |
| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 websocket_socket_pool_manager_->CloseIdleSockets(); | 313 websocket_socket_pool_manager_->CloseIdleSockets(); |
| 314 spdy_session_pool_.CloseCurrentIdleSessions(); | 314 spdy_session_pool_.CloseCurrentIdleSessions(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 bool HttpNetworkSession::IsProtocolEnabled(AlternateProtocol protocol) const { | 317 bool HttpNetworkSession::IsProtocolEnabled(AlternateProtocol protocol) const { |
| 318 DCHECK(IsAlternateProtocolValid(protocol)); | 318 DCHECK(IsAlternateProtocolValid(protocol)); |
| 319 return enabled_protocols_[ | 319 return enabled_protocols_[ |
| 320 protocol - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION]; | 320 protocol - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION]; |
| 321 } | 321 } |
| 322 | 322 |
| 323 void HttpNetworkSession::GetNextProtos(NextProtoVector* next_protos) const { | 323 void HttpNetworkSession::GetAlpnProtos(NextProtoVector* alpn_protos) const { |
| 324 if (HttpStreamFactory::spdy_enabled()) { | 324 if (HttpStreamFactory::spdy_enabled()) { |
| 325 *next_protos = next_protos_; | 325 *alpn_protos = next_protos_; |
| 326 } else { | 326 } else { |
| 327 next_protos->clear(); | 327 alpn_protos->clear(); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 void HttpNetworkSession::GetNpnProtos(NextProtoVector* npn_protos) const { |
| 332 if (HttpStreamFactory::spdy_enabled()) { |
| 333 *npn_protos = next_protos_; |
| 334 DisableHTTP2(npn_protos); |
| 335 } else { |
| 336 npn_protos->clear(); |
| 337 } |
| 338 } |
| 339 |
| 331 bool HttpNetworkSession::HasSpdyExclusion( | 340 bool HttpNetworkSession::HasSpdyExclusion( |
| 332 HostPortPair host_port_pair) const { | 341 HostPortPair host_port_pair) const { |
| 333 return params_.forced_spdy_exclusions.find(host_port_pair) != | 342 return params_.forced_spdy_exclusions.find(host_port_pair) != |
| 334 params_.forced_spdy_exclusions.end(); | 343 params_.forced_spdy_exclusions.end(); |
| 335 } | 344 } |
| 336 | 345 |
| 337 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( | 346 ClientSocketPoolManager* HttpNetworkSession::GetSocketPoolManager( |
| 338 SocketPoolType pool_type) { | 347 SocketPoolType pool_type) { |
| 339 switch (pool_type) { | 348 switch (pool_type) { |
| 340 case NORMAL_SOCKET_POOL: | 349 case NORMAL_SOCKET_POOL: |
| 341 return normal_socket_pool_manager_.get(); | 350 return normal_socket_pool_manager_.get(); |
| 342 case WEBSOCKET_SOCKET_POOL: | 351 case WEBSOCKET_SOCKET_POOL: |
| 343 return websocket_socket_pool_manager_.get(); | 352 return websocket_socket_pool_manager_.get(); |
| 344 default: | 353 default: |
| 345 NOTREACHED(); | 354 NOTREACHED(); |
| 346 break; | 355 break; |
| 347 } | 356 } |
| 348 return NULL; | 357 return NULL; |
| 349 } | 358 } |
| 350 | 359 |
| 351 } // namespace net | 360 } // namespace net |
| OLD | NEW |