| 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 18 matching lines...) Expand all Loading... |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 } // namespace | 31 } // namespace |
| 32 | 32 |
| 33 SpdySessionPool::SpdySessionPool( | 33 SpdySessionPool::SpdySessionPool( |
| 34 HostResolver* resolver, | 34 HostResolver* resolver, |
| 35 SSLConfigService* ssl_config_service, | 35 SSLConfigService* ssl_config_service, |
| 36 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 36 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
| 37 TransportSecurityState* transport_security_state, | 37 TransportSecurityState* transport_security_state, |
| 38 bool enable_ping_based_connection_checking, | 38 bool enable_ping_based_connection_checking, |
| 39 bool enable_priority_dependencies, |
| 39 NextProto default_protocol, | 40 NextProto default_protocol, |
| 40 size_t session_max_recv_window_size, | 41 size_t session_max_recv_window_size, |
| 41 size_t stream_max_recv_window_size, | 42 size_t stream_max_recv_window_size, |
| 42 SpdySessionPool::TimeFunc time_func, | 43 SpdySessionPool::TimeFunc time_func, |
| 43 ProxyDelegate* proxy_delegate) | 44 ProxyDelegate* proxy_delegate) |
| 44 : http_server_properties_(http_server_properties), | 45 : http_server_properties_(http_server_properties), |
| 45 transport_security_state_(transport_security_state), | 46 transport_security_state_(transport_security_state), |
| 46 ssl_config_service_(ssl_config_service), | 47 ssl_config_service_(ssl_config_service), |
| 47 resolver_(resolver), | 48 resolver_(resolver), |
| 48 verify_domain_authentication_(true), | 49 verify_domain_authentication_(true), |
| 49 enable_sending_initial_data_(true), | 50 enable_sending_initial_data_(true), |
| 50 enable_ping_based_connection_checking_( | 51 enable_ping_based_connection_checking_( |
| 51 enable_ping_based_connection_checking), | 52 enable_ping_based_connection_checking), |
| 53 enable_priority_dependencies_(enable_priority_dependencies), |
| 52 // TODO(akalin): Force callers to have a valid value of | 54 // TODO(akalin): Force callers to have a valid value of |
| 53 // |default_protocol_|. | 55 // |default_protocol_|. |
| 54 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31 | 56 default_protocol_((default_protocol == kProtoUnknown) ? kProtoSPDY31 |
| 55 : default_protocol), | 57 : default_protocol), |
| 56 session_max_recv_window_size_(session_max_recv_window_size), | 58 session_max_recv_window_size_(session_max_recv_window_size), |
| 57 stream_max_recv_window_size_(stream_max_recv_window_size), | 59 stream_max_recv_window_size_(stream_max_recv_window_size), |
| 58 time_func_(time_func), | 60 time_func_(time_func), |
| 59 proxy_delegate_(proxy_delegate) { | 61 proxy_delegate_(proxy_delegate) { |
| 60 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion && | 62 DCHECK(default_protocol_ >= kProtoSPDYMinimumVersion && |
| 61 default_protocol_ <= kProtoSPDYMaximumVersion); | 63 default_protocol_ <= kProtoSPDYMaximumVersion); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 88 bool is_secure) { | 90 bool is_secure) { |
| 89 DCHECK_GE(default_protocol_, kProtoSPDYMinimumVersion); | 91 DCHECK_GE(default_protocol_, kProtoSPDYMinimumVersion); |
| 90 DCHECK_LE(default_protocol_, kProtoSPDYMaximumVersion); | 92 DCHECK_LE(default_protocol_, kProtoSPDYMaximumVersion); |
| 91 | 93 |
| 92 UMA_HISTOGRAM_ENUMERATION( | 94 UMA_HISTOGRAM_ENUMERATION( |
| 93 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 95 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
| 94 | 96 |
| 95 scoped_ptr<SpdySession> new_session(new SpdySession( | 97 scoped_ptr<SpdySession> new_session(new SpdySession( |
| 96 key, http_server_properties_, transport_security_state_, | 98 key, http_server_properties_, transport_security_state_, |
| 97 verify_domain_authentication_, enable_sending_initial_data_, | 99 verify_domain_authentication_, enable_sending_initial_data_, |
| 98 enable_ping_based_connection_checking_, default_protocol_, | 100 enable_ping_based_connection_checking_, enable_priority_dependencies_, |
| 99 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, | 101 default_protocol_, session_max_recv_window_size_, |
| 100 proxy_delegate_, net_log.net_log())); | 102 stream_max_recv_window_size_, time_func_, proxy_delegate_, |
| 103 net_log.net_log())); |
| 101 | 104 |
| 102 new_session->InitializeWithSocket(std::move(connection), this, is_secure, | 105 new_session->InitializeWithSocket(std::move(connection), this, is_secure, |
| 103 certificate_error_code); | 106 certificate_error_code); |
| 104 | 107 |
| 105 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 108 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
| 106 sessions_.insert(new_session.release()); | 109 sessions_.insert(new_session.release()); |
| 107 MapKeyToAvailableSession(key, available_session); | 110 MapKeyToAvailableSession(key, available_session); |
| 108 | 111 |
| 109 net_log.AddEvent( | 112 net_log.AddEvent( |
| 110 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 113 NetLog::TYPE_HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 446 |
| 444 if (idle_only && (*it)->is_active()) | 447 if (idle_only && (*it)->is_active()) |
| 445 continue; | 448 continue; |
| 446 | 449 |
| 447 (*it)->CloseSessionOnError(error, description); | 450 (*it)->CloseSessionOnError(error, description); |
| 448 DCHECK(!IsSessionAvailable(*it)); | 451 DCHECK(!IsSessionAvailable(*it)); |
| 449 } | 452 } |
| 450 } | 453 } |
| 451 | 454 |
| 452 } // namespace net | 455 } // namespace net |
| OLD | NEW |