| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "net/http/http_auth_handler_factory.h" | 16 #include "net/http/http_auth_handler_factory.h" |
| 16 #include "net/http/http_response_body_drainer.h" | 17 #include "net/http/http_response_body_drainer.h" |
| 17 #include "net/http/http_stream_factory_impl.h" | 18 #include "net/http/http_stream_factory_impl.h" |
| 18 #include "net/http/url_security_manager.h" | 19 #include "net/http/url_security_manager.h" |
| 19 #include "net/proxy/proxy_service.h" | 20 #include "net/proxy/proxy_service.h" |
| 20 #include "net/quic/crypto/quic_random.h" | 21 #include "net/quic/crypto/quic_random.h" |
| 21 #include "net/quic/quic_clock.h" | 22 #include "net/quic/quic_clock.h" |
| 22 #include "net/quic/quic_crypto_client_stream_factory.h" | 23 #include "net/quic/quic_crypto_client_stream_factory.h" |
| 23 #include "net/quic/quic_protocol.h" | 24 #include "net/quic/quic_protocol.h" |
| 24 #include "net/quic/quic_stream_factory.h" | 25 #include "net/quic/quic_stream_factory.h" |
| 25 #include "net/quic/quic_utils.h" | 26 #include "net/quic/quic_utils.h" |
| 26 #include "net/socket/client_socket_factory.h" | 27 #include "net/socket/client_socket_factory.h" |
| 27 #include "net/socket/client_socket_pool_manager_impl.h" | 28 #include "net/socket/client_socket_pool_manager_impl.h" |
| 28 #include "net/socket/next_proto.h" | 29 #include "net/socket/next_proto.h" |
| 29 #include "net/socket/ssl_client_socket.h" | 30 #include "net/socket/ssl_client_socket.h" |
| 30 #include "net/spdy/hpack_huffman_aggregator.h" | 31 #include "net/spdy/hpack_huffman_aggregator.h" |
| 31 #include "net/spdy/spdy_session_pool.h" | 32 #include "net/spdy/spdy_session_pool.h" |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 net::ClientSocketPoolManager* CreateSocketPoolManager( | 36 net::ClientSocketPoolManager* CreateSocketPoolManager( |
| 36 net::HttpNetworkSession::SocketPoolType pool_type, | 37 net::HttpNetworkSession::SocketPoolType pool_type, |
| 37 const net::HttpNetworkSession::Params& params) { | 38 const net::HttpNetworkSession::Params& params) { |
| 39 // TODO(michaeln): Remove ScopedTracker below once crbug.com/454983 is fixed |
| 40 tracked_objects::ScopedTracker tracking_profile( |
| 41 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 42 "454983 CreateSocketPoolManager")); |
| 38 // TODO(yutak): Differentiate WebSocket pool manager and allow more | 43 // TODO(yutak): Differentiate WebSocket pool manager and allow more |
| 39 // simultaneous connections for WebSockets. | 44 // simultaneous connections for WebSockets. |
| 40 return new net::ClientSocketPoolManagerImpl( | 45 return new net::ClientSocketPoolManagerImpl( |
| 41 params.net_log, params.client_socket_factory | 46 params.net_log, params.client_socket_factory |
| 42 ? params.client_socket_factory | 47 ? params.client_socket_factory |
| 43 : net::ClientSocketFactory::GetDefaultFactory(), | 48 : net::ClientSocketFactory::GetDefaultFactory(), |
| 44 params.host_resolver, params.cert_verifier, params.channel_id_service, | 49 params.host_resolver, params.cert_verifier, params.channel_id_service, |
| 45 params.transport_security_state, params.cert_transparency_verifier, | 50 params.transport_security_state, params.cert_transparency_verifier, |
| 46 params.cert_policy_enforcer, params.ssl_session_cache_shard, | 51 params.cert_policy_enforcer, params.ssl_session_cache_shard, |
| 47 params.ssl_config_service, params.enable_ssl_connect_job_waiting, | 52 params.ssl_config_service, params.enable_ssl_connect_job_waiting, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 params.spdy_initial_max_concurrent_streams, | 154 params.spdy_initial_max_concurrent_streams, |
| 150 params.spdy_max_concurrent_streams_limit, | 155 params.spdy_max_concurrent_streams_limit, |
| 151 params.time_func, | 156 params.time_func, |
| 152 params.trusted_spdy_proxy), | 157 params.trusted_spdy_proxy), |
| 153 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), | 158 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), |
| 154 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), | 159 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), |
| 155 params_(params) { | 160 params_(params) { |
| 156 DCHECK(proxy_service_); | 161 DCHECK(proxy_service_); |
| 157 DCHECK(ssl_config_service_.get()); | 162 DCHECK(ssl_config_service_.get()); |
| 158 CHECK(http_server_properties_); | 163 CHECK(http_server_properties_); |
| 164 // TODO(michaeln): Remove ScopedTracker below once crbug.com/454983 is fixed |
| 165 tracked_objects::ScopedTracker tracking_profile( |
| 166 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 167 "454983 HttpNetworkSession::HttpNetworkSession")); |
| 159 | 168 |
| 160 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION; | 169 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION; |
| 161 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) { | 170 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) { |
| 162 enabled_protocols_[i - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] = false; | 171 enabled_protocols_[i - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] = false; |
| 163 } | 172 } |
| 164 | 173 |
| 165 // TODO(rtenneti): bug 116575 - consider combining the NextProto and | 174 // TODO(rtenneti): bug 116575 - consider combining the NextProto and |
| 166 // AlternateProtocol. | 175 // AlternateProtocol. |
| 167 for (std::vector<NextProto>::const_iterator it = params_.next_protos.begin(); | 176 for (std::vector<NextProto>::const_iterator it = params_.next_protos.begin(); |
| 168 it != params_.next_protos.end(); ++it) { | 177 it != params_.next_protos.end(); ++it) { |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 case WEBSOCKET_SOCKET_POOL: | 320 case WEBSOCKET_SOCKET_POOL: |
| 312 return websocket_socket_pool_manager_.get(); | 321 return websocket_socket_pool_manager_.get(); |
| 313 default: | 322 default: |
| 314 NOTREACHED(); | 323 NOTREACHED(); |
| 315 break; | 324 break; |
| 316 } | 325 } |
| 317 return NULL; | 326 return NULL; |
| 318 } | 327 } |
| 319 | 328 |
| 320 } // namespace net | 329 } // namespace net |
| OLD | NEW |