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