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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 SpdySessionPool::SpdySessionPool( | 41 SpdySessionPool::SpdySessionPool( |
42 HostResolver* resolver, | 42 HostResolver* resolver, |
43 SSLConfigService* ssl_config_service, | 43 SSLConfigService* ssl_config_service, |
44 HttpServerProperties* http_server_properties, | 44 HttpServerProperties* http_server_properties, |
45 TransportSecurityState* transport_security_state, | 45 TransportSecurityState* transport_security_state, |
46 bool enable_ping_based_connection_checking, | 46 bool enable_ping_based_connection_checking, |
47 size_t session_max_recv_window_size, | 47 size_t session_max_recv_window_size, |
48 size_t stream_max_recv_window_size, | 48 const SettingsMap& initial_settings, |
49 SpdySessionPool::TimeFunc time_func, | 49 SpdySessionPool::TimeFunc time_func, |
50 ProxyDelegate* proxy_delegate) | 50 ProxyDelegate* proxy_delegate) |
51 : http_server_properties_(http_server_properties), | 51 : http_server_properties_(http_server_properties), |
52 transport_security_state_(transport_security_state), | 52 transport_security_state_(transport_security_state), |
53 ssl_config_service_(ssl_config_service), | 53 ssl_config_service_(ssl_config_service), |
54 resolver_(resolver), | 54 resolver_(resolver), |
55 enable_sending_initial_data_(true), | 55 enable_sending_initial_data_(true), |
56 enable_ping_based_connection_checking_( | 56 enable_ping_based_connection_checking_( |
57 enable_ping_based_connection_checking), | 57 enable_ping_based_connection_checking), |
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 initial_settings_(initial_settings), |
60 time_func_(time_func), | 60 time_func_(time_func), |
61 push_delegate_(nullptr), | 61 push_delegate_(nullptr), |
62 proxy_delegate_(proxy_delegate) { | 62 proxy_delegate_(proxy_delegate) { |
63 NetworkChangeNotifier::AddIPAddressObserver(this); | 63 NetworkChangeNotifier::AddIPAddressObserver(this); |
64 if (ssl_config_service_.get()) | 64 if (ssl_config_service_.get()) |
65 ssl_config_service_->AddObserver(this); | 65 ssl_config_service_->AddObserver(this); |
66 CertDatabase::GetInstance()->AddObserver(this); | 66 CertDatabase::GetInstance()->AddObserver(this); |
67 } | 67 } |
68 | 68 |
69 SpdySessionPool::~SpdySessionPool() { | 69 SpdySessionPool::~SpdySessionPool() { |
(...skipping 15 matching lines...) Expand all Loading... |
85 const SpdySessionKey& key, | 85 const SpdySessionKey& key, |
86 std::unique_ptr<ClientSocketHandle> connection, | 86 std::unique_ptr<ClientSocketHandle> connection, |
87 const NetLogWithSource& net_log, | 87 const NetLogWithSource& net_log, |
88 bool is_secure) { | 88 bool is_secure) { |
89 TRACE_EVENT0(kNetTracingCategory, | 89 TRACE_EVENT0(kNetTracingCategory, |
90 "SpdySessionPool::CreateAvailableSessionFromSocket"); | 90 "SpdySessionPool::CreateAvailableSessionFromSocket"); |
91 | 91 |
92 UMA_HISTOGRAM_ENUMERATION( | 92 UMA_HISTOGRAM_ENUMERATION( |
93 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 93 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
94 | 94 |
95 std::unique_ptr<SpdySession> new_session(new SpdySession( | 95 auto new_session = base::MakeUnique<SpdySession>( |
96 key, http_server_properties_, transport_security_state_, | 96 key, http_server_properties_, transport_security_state_, |
97 enable_sending_initial_data_, enable_ping_based_connection_checking_, | 97 enable_sending_initial_data_, enable_ping_based_connection_checking_, |
98 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, | 98 session_max_recv_window_size_, initial_settings_, time_func_, |
99 push_delegate_, proxy_delegate_, net_log.net_log())); | 99 push_delegate_, proxy_delegate_, net_log.net_log()); |
100 | 100 |
101 new_session->InitializeWithSocket(std::move(connection), this, is_secure); | 101 new_session->InitializeWithSocket(std::move(connection), this, is_secure); |
102 | 102 |
103 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 103 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
104 sessions_.insert(new_session.release()); | 104 sessions_.insert(new_session.release()); |
105 MapKeyToAvailableSession(key, available_session); | 105 MapKeyToAvailableSession(key, available_session); |
106 | 106 |
107 net_log.AddEvent( | 107 net_log.AddEvent( |
108 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 108 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
109 available_session->net_log().source().ToEventParametersCallback()); | 109 available_session->net_log().source().ToEventParametersCallback()); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 444 |
445 if (idle_only && (*it)->is_active()) | 445 if (idle_only && (*it)->is_active()) |
446 continue; | 446 continue; |
447 | 447 |
448 (*it)->CloseSessionOnError(error, description); | 448 (*it)->CloseSessionOnError(error, description); |
449 DCHECK(!IsSessionAvailable(*it)); | 449 DCHECK(!IsSessionAvailable(*it)); |
450 } | 450 } |
451 } | 451 } |
452 | 452 |
453 } // namespace net | 453 } // namespace net |
OLD | NEW |