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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 stream_max_recv_window_size_(stream_max_recv_window_size), |
60 time_func_(time_func), | 60 time_func_(time_func), |
| 61 push_delegate_(nullptr), |
61 proxy_delegate_(proxy_delegate) { | 62 proxy_delegate_(proxy_delegate) { |
62 NetworkChangeNotifier::AddIPAddressObserver(this); | 63 NetworkChangeNotifier::AddIPAddressObserver(this); |
63 if (ssl_config_service_.get()) | 64 if (ssl_config_service_.get()) |
64 ssl_config_service_->AddObserver(this); | 65 ssl_config_service_->AddObserver(this); |
65 CertDatabase::GetInstance()->AddObserver(this); | 66 CertDatabase::GetInstance()->AddObserver(this); |
66 } | 67 } |
67 | 68 |
68 SpdySessionPool::~SpdySessionPool() { | 69 SpdySessionPool::~SpdySessionPool() { |
69 CloseAllSessions(); | 70 CloseAllSessions(); |
70 | 71 |
(...skipping 17 matching lines...) Expand all Loading... |
88 TRACE_EVENT0(kNetTracingCategory, | 89 TRACE_EVENT0(kNetTracingCategory, |
89 "SpdySessionPool::CreateAvailableSessionFromSocket"); | 90 "SpdySessionPool::CreateAvailableSessionFromSocket"); |
90 | 91 |
91 UMA_HISTOGRAM_ENUMERATION( | 92 UMA_HISTOGRAM_ENUMERATION( |
92 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 93 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
93 | 94 |
94 std::unique_ptr<SpdySession> new_session(new SpdySession( | 95 std::unique_ptr<SpdySession> new_session(new SpdySession( |
95 key, http_server_properties_, transport_security_state_, | 96 key, http_server_properties_, transport_security_state_, |
96 enable_sending_initial_data_, enable_ping_based_connection_checking_, | 97 enable_sending_initial_data_, enable_ping_based_connection_checking_, |
97 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, | 98 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, |
98 proxy_delegate_, net_log.net_log())); | 99 push_delegate_, proxy_delegate_, net_log.net_log())); |
99 | 100 |
100 new_session->InitializeWithSocket(std::move(connection), this, is_secure); | 101 new_session->InitializeWithSocket(std::move(connection), this, is_secure); |
101 | 102 |
102 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 103 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
103 sessions_.insert(new_session.release()); | 104 sessions_.insert(new_session.release()); |
104 MapKeyToAvailableSession(key, available_session); | 105 MapKeyToAvailableSession(key, available_session); |
105 | 106 |
106 net_log.AddEvent( | 107 net_log.AddEvent( |
107 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 108 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
108 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... |
443 | 444 |
444 if (idle_only && (*it)->is_active()) | 445 if (idle_only && (*it)->is_active()) |
445 continue; | 446 continue; |
446 | 447 |
447 (*it)->CloseSessionOnError(error, description); | 448 (*it)->CloseSessionOnError(error, description); |
448 DCHECK(!IsSessionAvailable(*it)); | 449 DCHECK(!IsSessionAvailable(*it)); |
449 } | 450 } |
450 } | 451 } |
451 | 452 |
452 } // namespace net | 453 } // namespace net |
OLD | NEW |