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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 enable_spdy_credential_frames(false), | 75 enable_spdy_credential_frames(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 enable_quic(false), | 83 enable_quic(false), |
84 origin_port_to_force_quic_on(0), | 84 origin_port_to_force_quic_on(0), |
85 use_spdy_over_quic(false), | |
86 quic_clock(NULL), | 85 quic_clock(NULL), |
87 quic_random(NULL), | 86 quic_random(NULL), |
88 enable_user_alternate_protocol_ports(false) { | 87 enable_user_alternate_protocol_ports(false) { |
89 } | 88 } |
90 | 89 |
91 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. | 90 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. |
92 HttpNetworkSession::HttpNetworkSession(const Params& params) | 91 HttpNetworkSession::HttpNetworkSession(const Params& params) |
93 : net_log_(params.net_log), | 92 : net_log_(params.net_log), |
94 network_delegate_(params.network_delegate), | 93 network_delegate_(params.network_delegate), |
95 http_server_properties_(params.http_server_properties), | 94 http_server_properties_(params.http_server_properties), |
96 cert_verifier_(params.cert_verifier), | 95 cert_verifier_(params.cert_verifier), |
97 http_auth_handler_factory_(params.http_auth_handler_factory), | 96 http_auth_handler_factory_(params.http_auth_handler_factory), |
98 force_http_pipelining_(params.force_http_pipelining), | 97 force_http_pipelining_(params.force_http_pipelining), |
99 proxy_service_(params.proxy_service), | 98 proxy_service_(params.proxy_service), |
100 ssl_config_service_(params.ssl_config_service), | 99 ssl_config_service_(params.ssl_config_service), |
101 normal_socket_pool_manager_( | 100 normal_socket_pool_manager_( |
102 CreateSocketPoolManager(NORMAL_SOCKET_POOL, params)), | 101 CreateSocketPoolManager(NORMAL_SOCKET_POOL, params)), |
103 websocket_socket_pool_manager_( | 102 websocket_socket_pool_manager_( |
104 CreateSocketPoolManager(WEBSOCKET_SOCKET_POOL, params)), | 103 CreateSocketPoolManager(WEBSOCKET_SOCKET_POOL, params)), |
105 quic_stream_factory_(params.host_resolver, | 104 quic_stream_factory_(params.host_resolver, |
106 params.client_socket_factory ? | 105 params.client_socket_factory ? |
107 params.client_socket_factory : | 106 params.client_socket_factory : |
108 net::ClientSocketFactory::GetDefaultFactory(), | 107 net::ClientSocketFactory::GetDefaultFactory(), |
109 params.quic_random ? params.quic_random : | 108 params.quic_random ? params.quic_random : |
110 QuicRandom::GetInstance(), | 109 QuicRandom::GetInstance(), |
111 params.quic_clock ? params. quic_clock : | 110 params.quic_clock ? params. quic_clock : |
112 new QuicClock(), | 111 new QuicClock()), |
113 params.use_spdy_over_quic), | |
114 spdy_session_pool_(params.host_resolver, | 112 spdy_session_pool_(params.host_resolver, |
115 params.ssl_config_service, | 113 params.ssl_config_service, |
116 params.http_server_properties, | 114 params.http_server_properties, |
117 params.max_spdy_sessions_per_domain, | 115 params.max_spdy_sessions_per_domain, |
118 params.force_spdy_single_domain, | 116 params.force_spdy_single_domain, |
119 params.enable_spdy_ip_pooling, | 117 params.enable_spdy_ip_pooling, |
120 params.enable_spdy_credential_frames, | 118 params.enable_spdy_credential_frames, |
121 params.enable_spdy_compression, | 119 params.enable_spdy_compression, |
122 params.enable_spdy_ping_based_connection_checking, | 120 params.enable_spdy_ping_based_connection_checking, |
123 params.spdy_default_protocol, | 121 params.spdy_default_protocol, |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 Value* HttpNetworkSession::SpdySessionPoolInfoToValue() const { | 186 Value* HttpNetworkSession::SpdySessionPoolInfoToValue() const { |
189 return spdy_session_pool_.SpdySessionPoolInfoToValue(); | 187 return spdy_session_pool_.SpdySessionPoolInfoToValue(); |
190 } | 188 } |
191 | 189 |
192 Value* HttpNetworkSession::QuicInfoToValue() const { | 190 Value* HttpNetworkSession::QuicInfoToValue() const { |
193 base::DictionaryValue* dict = new base::DictionaryValue(); | 191 base::DictionaryValue* dict = new base::DictionaryValue(); |
194 dict->Set("sessions", quic_stream_factory_.QuicStreamFactoryInfoToValue()); | 192 dict->Set("sessions", quic_stream_factory_.QuicStreamFactoryInfoToValue()); |
195 dict->SetBoolean("quic_enabled", params_.enable_quic); | 193 dict->SetBoolean("quic_enabled", params_.enable_quic); |
196 dict->SetInteger("origin_port_to_force_quic_on", | 194 dict->SetInteger("origin_port_to_force_quic_on", |
197 params_.origin_port_to_force_quic_on); | 195 params_.origin_port_to_force_quic_on); |
198 dict->SetBoolean("use_spdy_over_quic", params_.use_spdy_over_quic); | |
199 | |
200 return dict; | 196 return dict; |
201 } | 197 } |
202 | 198 |
203 void HttpNetworkSession::CloseAllConnections() { | 199 void HttpNetworkSession::CloseAllConnections() { |
204 normal_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); | 200 normal_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); |
205 websocket_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); | 201 websocket_socket_pool_manager_->FlushSocketPoolsWithError(ERR_ABORTED); |
206 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED); | 202 spdy_session_pool_.CloseCurrentSessions(ERR_ABORTED); |
207 quic_stream_factory_.CloseAllSessions(ERR_ABORTED); | 203 quic_stream_factory_.CloseAllSessions(ERR_ABORTED); |
208 } | 204 } |
209 | 205 |
(...skipping 11 matching lines...) Expand all Loading... |
221 case WEBSOCKET_SOCKET_POOL: | 217 case WEBSOCKET_SOCKET_POOL: |
222 return websocket_socket_pool_manager_.get(); | 218 return websocket_socket_pool_manager_.get(); |
223 default: | 219 default: |
224 NOTREACHED(); | 220 NOTREACHED(); |
225 break; | 221 break; |
226 } | 222 } |
227 return NULL; | 223 return NULL; |
228 } | 224 } |
229 | 225 |
230 } // namespace net | 226 } // namespace net |
OLD | NEW |