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