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