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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 SPDY_SESSION_GET_MAX = 4 | 37 SPDY_SESSION_GET_MAX = 4 |
38 }; | 38 }; |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 SpdySessionPool::SpdySessionPool( | 42 SpdySessionPool::SpdySessionPool( |
43 HostResolver* resolver, | 43 HostResolver* resolver, |
44 SSLConfigService* ssl_config_service, | 44 SSLConfigService* ssl_config_service, |
45 HttpServerProperties* http_server_properties, | 45 HttpServerProperties* http_server_properties, |
46 TransportSecurityState* transport_security_state, | 46 TransportSecurityState* transport_security_state, |
| 47 HttpNetworkSession* http_network_session, |
47 bool enable_ping_based_connection_checking, | 48 bool enable_ping_based_connection_checking, |
48 size_t session_max_recv_window_size, | 49 size_t session_max_recv_window_size, |
49 const SettingsMap& initial_settings, | 50 const SettingsMap& initial_settings, |
50 SpdySessionPool::TimeFunc time_func, | 51 SpdySessionPool::TimeFunc time_func, |
51 ProxyDelegate* proxy_delegate) | 52 ProxyDelegate* proxy_delegate) |
52 : http_server_properties_(http_server_properties), | 53 : http_server_properties_(http_server_properties), |
53 transport_security_state_(transport_security_state), | 54 transport_security_state_(transport_security_state), |
| 55 http_network_session_(http_network_session), |
54 ssl_config_service_(ssl_config_service), | 56 ssl_config_service_(ssl_config_service), |
55 resolver_(resolver), | 57 resolver_(resolver), |
56 enable_sending_initial_data_(true), | 58 enable_sending_initial_data_(true), |
57 enable_ping_based_connection_checking_( | 59 enable_ping_based_connection_checking_( |
58 enable_ping_based_connection_checking), | 60 enable_ping_based_connection_checking), |
59 session_max_recv_window_size_(session_max_recv_window_size), | 61 session_max_recv_window_size_(session_max_recv_window_size), |
60 initial_settings_(initial_settings), | 62 initial_settings_(initial_settings), |
61 time_func_(time_func), | 63 time_func_(time_func), |
62 push_delegate_(nullptr), | 64 push_delegate_(nullptr), |
63 proxy_delegate_(proxy_delegate) { | 65 proxy_delegate_(proxy_delegate) { |
(...skipping 24 matching lines...) Expand all Loading... |
88 const NetLogWithSource& net_log, | 90 const NetLogWithSource& net_log, |
89 bool is_secure) { | 91 bool is_secure) { |
90 TRACE_EVENT0(kNetTracingCategory, | 92 TRACE_EVENT0(kNetTracingCategory, |
91 "SpdySessionPool::CreateAvailableSessionFromSocket"); | 93 "SpdySessionPool::CreateAvailableSessionFromSocket"); |
92 | 94 |
93 UMA_HISTOGRAM_ENUMERATION( | 95 UMA_HISTOGRAM_ENUMERATION( |
94 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 96 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
95 | 97 |
96 auto new_session = base::MakeUnique<SpdySession>( | 98 auto new_session = base::MakeUnique<SpdySession>( |
97 key, http_server_properties_, transport_security_state_, | 99 key, http_server_properties_, transport_security_state_, |
98 enable_sending_initial_data_, enable_ping_based_connection_checking_, | 100 http_network_session_, enable_sending_initial_data_, |
99 session_max_recv_window_size_, initial_settings_, time_func_, | 101 enable_ping_based_connection_checking_, session_max_recv_window_size_, |
100 push_delegate_, proxy_delegate_, net_log.net_log()); | 102 initial_settings_, time_func_, push_delegate_, proxy_delegate_, |
| 103 net_log.net_log()); |
101 | 104 |
102 new_session->InitializeWithSocket(std::move(connection), this, is_secure); | 105 new_session->InitializeWithSocket(std::move(connection), this, is_secure); |
103 | 106 |
104 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 107 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
105 sessions_.insert(new_session.release()); | 108 sessions_.insert(new_session.release()); |
106 MapKeyToAvailableSession(key, available_session); | 109 MapKeyToAvailableSession(key, available_session); |
107 | 110 |
108 net_log.AddEvent( | 111 net_log.AddEvent( |
109 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 112 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
110 available_session->net_log().source().ToEventParametersCallback()); | 113 available_session->net_log().source().ToEventParametersCallback()); |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 481 |
479 if (idle_only && (*it)->is_active()) | 482 if (idle_only && (*it)->is_active()) |
480 continue; | 483 continue; |
481 | 484 |
482 (*it)->CloseSessionOnError(error, description); | 485 (*it)->CloseSessionOnError(error, description); |
483 DCHECK(!IsSessionAvailable(*it)); | 486 DCHECK(!IsSessionAvailable(*it)); |
484 } | 487 } |
485 } | 488 } |
486 | 489 |
487 } // namespace net | 490 } // namespace net |
OLD | NEW |