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/spdy/spdy_session_pool.h" | 5 #include "net/spdy/spdy_session_pool.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 SSLConfigService* ssl_config_service, | 34 SSLConfigService* ssl_config_service, |
35 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 35 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
36 TransportSecurityState* transport_security_state, | 36 TransportSecurityState* transport_security_state, |
37 bool enable_compression, | 37 bool enable_compression, |
38 bool enable_ping_based_connection_checking, | 38 bool enable_ping_based_connection_checking, |
39 NextProto default_protocol, | 39 NextProto default_protocol, |
40 size_t session_max_recv_window_size, | 40 size_t session_max_recv_window_size, |
41 size_t stream_max_recv_window_size, | 41 size_t stream_max_recv_window_size, |
42 size_t initial_max_concurrent_streams, | 42 size_t initial_max_concurrent_streams, |
43 SpdySessionPool::TimeFunc time_func, | 43 SpdySessionPool::TimeFunc time_func, |
44 const std::string& trusted_spdy_proxy) | 44 ProxyDelegate* proxy_delegate) |
45 : http_server_properties_(http_server_properties), | 45 : http_server_properties_(http_server_properties), |
46 transport_security_state_(transport_security_state), | 46 transport_security_state_(transport_security_state), |
47 ssl_config_service_(ssl_config_service), | 47 ssl_config_service_(ssl_config_service), |
48 resolver_(resolver), | 48 resolver_(resolver), |
49 verify_domain_authentication_(true), | 49 verify_domain_authentication_(true), |
50 enable_sending_initial_data_(true), | 50 enable_sending_initial_data_(true), |
51 enable_compression_(enable_compression), | 51 enable_compression_(enable_compression), |
52 enable_ping_based_connection_checking_( | 52 enable_ping_based_connection_checking_( |
53 enable_ping_based_connection_checking), | 53 enable_ping_based_connection_checking), |
54 // TODO(akalin): Force callers to have a valid value of | 54 // TODO(akalin): Force callers to have a valid value of |
55 // |default_protocol_|. | 55 // |default_protocol_|. |
56 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31 | 56 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31 |
57 : default_protocol), | 57 : default_protocol), |
58 session_max_recv_window_size_(session_max_recv_window_size), | 58 session_max_recv_window_size_(session_max_recv_window_size), |
59 stream_max_recv_window_size_(stream_max_recv_window_size), | 59 stream_max_recv_window_size_(stream_max_recv_window_size), |
60 initial_max_concurrent_streams_(initial_max_concurrent_streams), | 60 initial_max_concurrent_streams_(initial_max_concurrent_streams), |
61 time_func_(time_func), | 61 time_func_(time_func), |
62 trusted_spdy_proxy_(HostPortPair::FromString(trusted_spdy_proxy)) { | 62 proxy_delegate_(proxy_delegate) { |
63 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion && | 63 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion && |
64 default_protocol_ <= kProtoSPDYMaximumVersion); | 64 default_protocol_ <= kProtoSPDYMaximumVersion); |
65 NetworkChangeNotifier::AddIPAddressObserver(this); | 65 NetworkChangeNotifier::AddIPAddressObserver(this); |
66 if (ssl_config_service_.get()) | 66 if (ssl_config_service_.get()) |
67 ssl_config_service_->AddObserver(this); | 67 ssl_config_service_->AddObserver(this); |
68 CertDatabase::GetInstance()->AddObserver(this); | 68 CertDatabase::GetInstance()->AddObserver(this); |
69 } | 69 } |
70 | 70 |
71 SpdySessionPool::~SpdySessionPool() { | 71 SpdySessionPool::~SpdySessionPool() { |
72 CloseAllSessions(); | 72 CloseAllSessions(); |
(...skipping 21 matching lines...) Expand all Loading... |
94 | 94 |
95 UMA_HISTOGRAM_ENUMERATION( | 95 UMA_HISTOGRAM_ENUMERATION( |
96 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 96 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
97 | 97 |
98 scoped_ptr<SpdySession> new_session(new SpdySession( | 98 scoped_ptr<SpdySession> new_session(new SpdySession( |
99 key, http_server_properties_, transport_security_state_, | 99 key, http_server_properties_, transport_security_state_, |
100 verify_domain_authentication_, enable_sending_initial_data_, | 100 verify_domain_authentication_, enable_sending_initial_data_, |
101 enable_compression_, enable_ping_based_connection_checking_, | 101 enable_compression_, enable_ping_based_connection_checking_, |
102 default_protocol_, session_max_recv_window_size_, | 102 default_protocol_, session_max_recv_window_size_, |
103 stream_max_recv_window_size_, initial_max_concurrent_streams_, time_func_, | 103 stream_max_recv_window_size_, initial_max_concurrent_streams_, time_func_, |
104 trusted_spdy_proxy_, net_log.net_log())); | 104 proxy_delegate_, net_log.net_log())); |
105 | 105 |
106 new_session->InitializeWithSocket(std::move(connection), this, is_secure, | 106 new_session->InitializeWithSocket(std::move(connection), this, is_secure, |
107 certificate_error_code); | 107 certificate_error_code); |
108 | 108 |
109 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 109 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
110 sessions_.insert(new_session.release()); | 110 sessions_.insert(new_session.release()); |
111 MapKeyToAvailableSession(key, available_session); | 111 MapKeyToAvailableSession(key, available_session); |
112 | 112 |
113 net_log.AddEvent( | 113 net_log.AddEvent( |
114 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 114 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 | 371 |
372 if (idle_only && (*it)->is_active()) | 372 if (idle_only && (*it)->is_active()) |
373 continue; | 373 continue; |
374 | 374 |
375 (*it)->CloseSessionOnError(error, description); | 375 (*it)->CloseSessionOnError(error, description); |
376 DCHECK(!IsSessionAvailable(*it)); | 376 DCHECK(!IsSessionAvailable(*it)); |
377 } | 377 } |
378 } | 378 } |
379 | 379 |
380 } // namespace net | 380 } // namespace net |
OLD | NEW |