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 28 matching lines...) Expand all Loading... |
39 TransportSecurityState* transport_security_state, | 39 TransportSecurityState* transport_security_state, |
40 bool enable_ping_based_connection_checking, | 40 bool enable_ping_based_connection_checking, |
41 size_t session_max_recv_window_size, | 41 size_t session_max_recv_window_size, |
42 size_t stream_max_recv_window_size, | 42 size_t stream_max_recv_window_size, |
43 SpdySessionPool::TimeFunc time_func, | 43 SpdySessionPool::TimeFunc time_func, |
44 ProxyDelegate* proxy_delegate) | 44 ProxyDelegate* proxy_delegate) |
45 : http_server_properties_(http_server_properties), | 45 : http_server_properties_(http_server_properties), |
46 transport_security_state_(transport_security_state), | 46 transport_security_state_(transport_security_state), |
47 ssl_config_service_(ssl_config_service), | 47 ssl_config_service_(ssl_config_service), |
48 resolver_(resolver), | 48 resolver_(resolver), |
49 verify_domain_authentication_(true), | |
50 enable_sending_initial_data_(true), | 49 enable_sending_initial_data_(true), |
51 enable_ping_based_connection_checking_( | 50 enable_ping_based_connection_checking_( |
52 enable_ping_based_connection_checking), | 51 enable_ping_based_connection_checking), |
53 session_max_recv_window_size_(session_max_recv_window_size), | 52 session_max_recv_window_size_(session_max_recv_window_size), |
54 stream_max_recv_window_size_(stream_max_recv_window_size), | 53 stream_max_recv_window_size_(stream_max_recv_window_size), |
55 time_func_(time_func), | 54 time_func_(time_func), |
56 proxy_delegate_(proxy_delegate) { | 55 proxy_delegate_(proxy_delegate) { |
57 NetworkChangeNotifier::AddIPAddressObserver(this); | 56 NetworkChangeNotifier::AddIPAddressObserver(this); |
58 if (ssl_config_service_.get()) | 57 if (ssl_config_service_.get()) |
59 ssl_config_service_->AddObserver(this); | 58 ssl_config_service_->AddObserver(this); |
(...skipping 21 matching lines...) Expand all Loading... |
81 const NetLogWithSource& net_log, | 80 const NetLogWithSource& net_log, |
82 int certificate_error_code, | 81 int certificate_error_code, |
83 bool is_secure) { | 82 bool is_secure) { |
84 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); | 83 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); |
85 | 84 |
86 UMA_HISTOGRAM_ENUMERATION( | 85 UMA_HISTOGRAM_ENUMERATION( |
87 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 86 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
88 | 87 |
89 std::unique_ptr<SpdySession> new_session(new SpdySession( | 88 std::unique_ptr<SpdySession> new_session(new SpdySession( |
90 key, http_server_properties_, transport_security_state_, | 89 key, http_server_properties_, transport_security_state_, |
91 verify_domain_authentication_, enable_sending_initial_data_, | 90 enable_sending_initial_data_, enable_ping_based_connection_checking_, |
92 enable_ping_based_connection_checking_, session_max_recv_window_size_, | 91 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, |
93 stream_max_recv_window_size_, time_func_, proxy_delegate_, | 92 proxy_delegate_, net_log.net_log())); |
94 net_log.net_log())); | |
95 | 93 |
96 new_session->InitializeWithSocket(std::move(connection), this, is_secure, | 94 new_session->InitializeWithSocket(std::move(connection), this, is_secure, |
97 certificate_error_code); | 95 certificate_error_code); |
98 | 96 |
99 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 97 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
100 sessions_.insert(new_session.release()); | 98 sessions_.insert(new_session.release()); |
101 MapKeyToAvailableSession(key, available_session); | 99 MapKeyToAvailableSession(key, available_session); |
102 | 100 |
103 net_log.AddEvent( | 101 net_log.AddEvent( |
104 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 102 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 436 |
439 if (idle_only && (*it)->is_active()) | 437 if (idle_only && (*it)->is_active()) |
440 continue; | 438 continue; |
441 | 439 |
442 (*it)->CloseSessionOnError(error, description); | 440 (*it)->CloseSessionOnError(error, description); |
443 DCHECK(!IsSessionAvailable(*it)); | 441 DCHECK(!IsSessionAvailable(*it)); |
444 } | 442 } |
445 } | 443 } |
446 | 444 |
447 } // namespace net | 445 } // namespace net |
OLD | NEW |