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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 force_spdy_always(false), | 89 force_spdy_always(false), |
85 use_alternate_protocols(false), | 90 use_alternate_protocols(false), |
86 alternate_protocol_probability_threshold(1), | 91 alternate_protocol_probability_threshold(1), |
87 enable_quic(false), | 92 enable_quic(false), |
88 enable_quic_port_selection(true), | 93 enable_quic_port_selection(true), |
89 quic_always_require_handshake_confirmation(false), | 94 quic_always_require_handshake_confirmation(false), |
90 quic_disable_connection_pooling(false), | 95 quic_disable_connection_pooling(false), |
91 quic_load_server_info_timeout_ms(0), | 96 quic_load_server_info_timeout_ms(0), |
92 quic_load_server_info_timeout_srtt_multiplier(0.0f), | 97 quic_load_server_info_timeout_srtt_multiplier(0.0f), |
93 quic_enable_truncated_connection_ids(false), | 98 quic_enable_truncated_connection_ids(false), |
| 99 quic_enable_connection_racing(false), |
94 quic_clock(NULL), | 100 quic_clock(NULL), |
95 quic_random(NULL), | 101 quic_random(NULL), |
96 quic_max_packet_length(kDefaultMaxPacketSize), | 102 quic_max_packet_length(kDefaultMaxPacketSize), |
97 enable_user_alternate_protocol_ports(false), | 103 enable_user_alternate_protocol_ports(false), |
98 quic_crypto_client_stream_factory(NULL), | 104 quic_crypto_client_stream_factory(NULL), |
99 proxy_delegate(NULL) { | 105 proxy_delegate(NULL) { |
100 quic_supported_versions.push_back(QUIC_VERSION_24); | 106 quic_supported_versions.push_back(QUIC_VERSION_24); |
101 } | 107 } |
102 | 108 |
103 HttpNetworkSession::Params::~Params() {} | 109 HttpNetworkSession::Params::~Params() {} |
(...skipping 25 matching lines...) Expand all Loading... |
129 params.quic_clock ? params.quic_clock : new QuicClock(), | 135 params.quic_clock ? params.quic_clock : new QuicClock(), |
130 params.quic_max_packet_length, | 136 params.quic_max_packet_length, |
131 params.quic_user_agent_id, | 137 params.quic_user_agent_id, |
132 params.quic_supported_versions, | 138 params.quic_supported_versions, |
133 params.enable_quic_port_selection, | 139 params.enable_quic_port_selection, |
134 params.quic_always_require_handshake_confirmation, | 140 params.quic_always_require_handshake_confirmation, |
135 params.quic_disable_connection_pooling, | 141 params.quic_disable_connection_pooling, |
136 params.quic_load_server_info_timeout_ms, | 142 params.quic_load_server_info_timeout_ms, |
137 params.quic_load_server_info_timeout_srtt_multiplier, | 143 params.quic_load_server_info_timeout_srtt_multiplier, |
138 params.quic_enable_truncated_connection_ids, | 144 params.quic_enable_truncated_connection_ids, |
| 145 params.quic_enable_connection_racing, |
139 params.quic_connection_options), | 146 params.quic_connection_options), |
140 spdy_session_pool_(params.host_resolver, | 147 spdy_session_pool_(params.host_resolver, |
141 params.ssl_config_service, | 148 params.ssl_config_service, |
142 params.http_server_properties, | 149 params.http_server_properties, |
143 params.transport_security_state, | 150 params.transport_security_state, |
144 params.force_spdy_single_domain, | 151 params.force_spdy_single_domain, |
145 params.enable_spdy_compression, | 152 params.enable_spdy_compression, |
146 params.enable_spdy_ping_based_connection_checking, | 153 params.enable_spdy_ping_based_connection_checking, |
147 params.spdy_default_protocol, | 154 params.spdy_default_protocol, |
148 params.spdy_stream_initial_recv_window_size, | 155 params.spdy_stream_initial_recv_window_size, |
149 params.spdy_initial_max_concurrent_streams, | 156 params.spdy_initial_max_concurrent_streams, |
150 params.spdy_max_concurrent_streams_limit, | 157 params.spdy_max_concurrent_streams_limit, |
151 params.time_func, | 158 params.time_func, |
152 params.trusted_spdy_proxy), | 159 params.trusted_spdy_proxy), |
153 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), | 160 http_stream_factory_(new HttpStreamFactoryImpl(this, false)), |
154 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), | 161 http_stream_factory_for_websocket_(new HttpStreamFactoryImpl(this, true)), |
155 params_(params) { | 162 params_(params) { |
156 DCHECK(proxy_service_); | 163 DCHECK(proxy_service_); |
157 DCHECK(ssl_config_service_.get()); | 164 DCHECK(ssl_config_service_.get()); |
158 CHECK(http_server_properties_); | 165 CHECK(http_server_properties_); |
| 166 // TODO(michaeln): Remove ScopedTracker below once crbug.com/454983 is fixed |
| 167 tracked_objects::ScopedTracker tracking_profile( |
| 168 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 169 "454983 HttpNetworkSession::HttpNetworkSession")); |
159 | 170 |
160 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION; | 171 for (int i = ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION; |
161 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) { | 172 i <= ALTERNATE_PROTOCOL_MAXIMUM_VALID_VERSION; ++i) { |
162 enabled_protocols_[i - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] = false; | 173 enabled_protocols_[i - ALTERNATE_PROTOCOL_MINIMUM_VALID_VERSION] = false; |
163 } | 174 } |
164 | 175 |
165 // TODO(rtenneti): bug 116575 - consider combining the NextProto and | 176 // TODO(rtenneti): bug 116575 - consider combining the NextProto and |
166 // AlternateProtocol. | 177 // AlternateProtocol. |
167 for (std::vector<NextProto>::const_iterator it = params_.next_protos.begin(); | 178 for (std::vector<NextProto>::const_iterator it = params_.next_protos.begin(); |
168 it != params_.next_protos.end(); ++it) { | 179 it != params_.next_protos.end(); ++it) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 case WEBSOCKET_SOCKET_POOL: | 322 case WEBSOCKET_SOCKET_POOL: |
312 return websocket_socket_pool_manager_.get(); | 323 return websocket_socket_pool_manager_.get(); |
313 default: | 324 default: |
314 NOTREACHED(); | 325 NOTREACHED(); |
315 break; | 326 break; |
316 } | 327 } |
317 return NULL; | 328 return NULL; |
318 } | 329 } |
319 | 330 |
320 } // namespace net | 331 } // namespace net |
OLD | NEW |