| 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/chromium/spdy_session_pool.h" | 5 #include "net/spdy/chromium/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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 SPDY_SESSION_GET_MAX = 4 | 43 SPDY_SESSION_GET_MAX = 4 |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 } // namespace | 46 } // namespace |
| 47 | 47 |
| 48 SpdySessionPool::SpdySessionPool( | 48 SpdySessionPool::SpdySessionPool( |
| 49 HostResolver* resolver, | 49 HostResolver* resolver, |
| 50 SSLConfigService* ssl_config_service, | 50 SSLConfigService* ssl_config_service, |
| 51 HttpServerProperties* http_server_properties, | 51 HttpServerProperties* http_server_properties, |
| 52 TransportSecurityState* transport_security_state, | 52 TransportSecurityState* transport_security_state, |
| 53 const QuicVersionVector& quic_supported_versions, |
| 53 bool enable_ping_based_connection_checking, | 54 bool enable_ping_based_connection_checking, |
| 54 size_t session_max_recv_window_size, | 55 size_t session_max_recv_window_size, |
| 55 const SettingsMap& initial_settings, | 56 const SettingsMap& initial_settings, |
| 56 SpdySessionPool::TimeFunc time_func, | 57 SpdySessionPool::TimeFunc time_func, |
| 57 ProxyDelegate* proxy_delegate) | 58 ProxyDelegate* proxy_delegate) |
| 58 : http_server_properties_(http_server_properties), | 59 : http_server_properties_(http_server_properties), |
| 59 transport_security_state_(transport_security_state), | 60 transport_security_state_(transport_security_state), |
| 60 ssl_config_service_(ssl_config_service), | 61 ssl_config_service_(ssl_config_service), |
| 61 resolver_(resolver), | 62 resolver_(resolver), |
| 63 quic_supported_versions_(quic_supported_versions), |
| 62 enable_sending_initial_data_(true), | 64 enable_sending_initial_data_(true), |
| 63 enable_ping_based_connection_checking_( | 65 enable_ping_based_connection_checking_( |
| 64 enable_ping_based_connection_checking), | 66 enable_ping_based_connection_checking), |
| 65 session_max_recv_window_size_(session_max_recv_window_size), | 67 session_max_recv_window_size_(session_max_recv_window_size), |
| 66 initial_settings_(initial_settings), | 68 initial_settings_(initial_settings), |
| 67 time_func_(time_func), | 69 time_func_(time_func), |
| 68 push_delegate_(nullptr), | 70 push_delegate_(nullptr), |
| 69 proxy_delegate_(proxy_delegate) { | 71 proxy_delegate_(proxy_delegate) { |
| 70 NetworkChangeNotifier::AddIPAddressObserver(this); | 72 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 71 if (ssl_config_service_.get()) | 73 if (ssl_config_service_.get()) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 95 const NetLogWithSource& net_log, | 97 const NetLogWithSource& net_log, |
| 96 bool is_secure) { | 98 bool is_secure) { |
| 97 TRACE_EVENT0(kNetTracingCategory, | 99 TRACE_EVENT0(kNetTracingCategory, |
| 98 "SpdySessionPool::CreateAvailableSessionFromSocket"); | 100 "SpdySessionPool::CreateAvailableSessionFromSocket"); |
| 99 | 101 |
| 100 UMA_HISTOGRAM_ENUMERATION( | 102 UMA_HISTOGRAM_ENUMERATION( |
| 101 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 103 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
| 102 | 104 |
| 103 auto new_session = base::MakeUnique<SpdySession>( | 105 auto new_session = base::MakeUnique<SpdySession>( |
| 104 key, http_server_properties_, transport_security_state_, | 106 key, http_server_properties_, transport_security_state_, |
| 105 enable_sending_initial_data_, enable_ping_based_connection_checking_, | 107 quic_supported_versions_, enable_sending_initial_data_, |
| 106 session_max_recv_window_size_, initial_settings_, time_func_, | 108 enable_ping_based_connection_checking_, session_max_recv_window_size_, |
| 107 push_delegate_, proxy_delegate_, net_log.net_log()); | 109 initial_settings_, time_func_, push_delegate_, proxy_delegate_, |
| 110 net_log.net_log()); |
| 108 | 111 |
| 109 new_session->InitializeWithSocket(std::move(connection), this, is_secure); | 112 new_session->InitializeWithSocket(std::move(connection), this, is_secure); |
| 110 | 113 |
| 111 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 114 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
| 112 sessions_.insert(new_session.release()); | 115 sessions_.insert(new_session.release()); |
| 113 MapKeyToAvailableSession(key, available_session); | 116 MapKeyToAvailableSession(key, available_session); |
| 114 | 117 |
| 115 net_log.AddEvent( | 118 net_log.AddEvent( |
| 116 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 119 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
| 117 available_session->net_log().source().ToEventParametersCallback()); | 120 available_session->net_log().source().ToEventParametersCallback()); |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 | 605 |
| 603 if (idle_only && (*it)->is_active()) | 606 if (idle_only && (*it)->is_active()) |
| 604 continue; | 607 continue; |
| 605 | 608 |
| 606 (*it)->CloseSessionOnError(error, description); | 609 (*it)->CloseSessionOnError(error, description); |
| 607 DCHECK(!IsSessionAvailable(*it)); | 610 DCHECK(!IsSessionAvailable(*it)); |
| 608 } | 611 } |
| 609 } | 612 } |
| 610 | 613 |
| 611 } // namespace net | 614 } // namespace net |
| OLD | NEW |