| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 if (ssl_config_service_.get()) | 71 if (ssl_config_service_.get()) |
| 72 ssl_config_service_->RemoveObserver(this); | 72 ssl_config_service_->RemoveObserver(this); |
| 73 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 73 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 74 CertDatabase::GetInstance()->RemoveObserver(this); | 74 CertDatabase::GetInstance()->RemoveObserver(this); |
| 75 } | 75 } |
| 76 | 76 |
| 77 base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( | 77 base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( |
| 78 const SpdySessionKey& key, | 78 const SpdySessionKey& key, |
| 79 std::unique_ptr<ClientSocketHandle> connection, | 79 std::unique_ptr<ClientSocketHandle> connection, |
| 80 const NetLogWithSource& net_log, | 80 const NetLogWithSource& net_log, |
| 81 int certificate_error_code, | |
| 82 bool is_secure) { | 81 bool is_secure) { |
| 83 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); | 82 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); |
| 84 | 83 |
| 85 UMA_HISTOGRAM_ENUMERATION( | 84 UMA_HISTOGRAM_ENUMERATION( |
| 86 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 85 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
| 87 | 86 |
| 88 std::unique_ptr<SpdySession> new_session(new SpdySession( | 87 std::unique_ptr<SpdySession> new_session(new SpdySession( |
| 89 key, http_server_properties_, transport_security_state_, | 88 key, http_server_properties_, transport_security_state_, |
| 90 enable_sending_initial_data_, enable_ping_based_connection_checking_, | 89 enable_sending_initial_data_, enable_ping_based_connection_checking_, |
| 91 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, | 90 session_max_recv_window_size_, stream_max_recv_window_size_, time_func_, |
| 92 proxy_delegate_, net_log.net_log())); | 91 proxy_delegate_, net_log.net_log())); |
| 93 | 92 |
| 94 new_session->InitializeWithSocket(std::move(connection), this, is_secure, | 93 new_session->InitializeWithSocket(std::move(connection), this, is_secure); |
| 95 certificate_error_code); | |
| 96 | 94 |
| 97 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); | 95 base::WeakPtr<SpdySession> available_session = new_session->GetWeakPtr(); |
| 98 sessions_.insert(new_session.release()); | 96 sessions_.insert(new_session.release()); |
| 99 MapKeyToAvailableSession(key, available_session); | 97 MapKeyToAvailableSession(key, available_session); |
| 100 | 98 |
| 101 net_log.AddEvent( | 99 net_log.AddEvent( |
| 102 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, | 100 NetLogEventType::HTTP2_SESSION_POOL_IMPORTED_SESSION_FROM_SOCKET, |
| 103 available_session->net_log().source().ToEventParametersCallback()); | 101 available_session->net_log().source().ToEventParametersCallback()); |
| 104 | 102 |
| 105 // Look up the IP address for this session so that we can match | 103 // Look up the IP address for this session so that we can match |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 | 434 |
| 437 if (idle_only && (*it)->is_active()) | 435 if (idle_only && (*it)->is_active()) |
| 438 continue; | 436 continue; |
| 439 | 437 |
| 440 (*it)->CloseSessionOnError(error, description); | 438 (*it)->CloseSessionOnError(error, description); |
| 441 DCHECK(!IsSessionAvailable(*it)); | 439 DCHECK(!IsSessionAvailable(*it)); |
| 442 } | 440 } |
| 443 } | 441 } |
| 444 | 442 |
| 445 } // namespace net | 443 } // namespace net |
| OLD | NEW |