| 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 | 71 |
| 72 if (ssl_config_service_.get()) | 72 if (ssl_config_service_.get()) |
| 73 ssl_config_service_->RemoveObserver(this); | 73 ssl_config_service_->RemoveObserver(this); |
| 74 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 74 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 75 CertDatabase::GetInstance()->RemoveObserver(this); | 75 CertDatabase::GetInstance()->RemoveObserver(this); |
| 76 } | 76 } |
| 77 | 77 |
| 78 base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( | 78 base::WeakPtr<SpdySession> SpdySessionPool::CreateAvailableSessionFromSocket( |
| 79 const SpdySessionKey& key, | 79 const SpdySessionKey& key, |
| 80 std::unique_ptr<ClientSocketHandle> connection, | 80 std::unique_ptr<ClientSocketHandle> connection, |
| 81 const BoundNetLog& net_log, | 81 const NetLogWithSource& net_log, |
| 82 int certificate_error_code, | 82 int certificate_error_code, |
| 83 bool is_secure) { | 83 bool is_secure) { |
| 84 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); | 84 TRACE_EVENT0("net", "SpdySessionPool::CreateAvailableSessionFromSocket"); |
| 85 | 85 |
| 86 UMA_HISTOGRAM_ENUMERATION( | 86 UMA_HISTOGRAM_ENUMERATION( |
| 87 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); | 87 "Net.SpdySessionGet", IMPORTED_FROM_SOCKET, SPDY_SESSION_GET_MAX); |
| 88 | 88 |
| 89 std::unique_ptr<SpdySession> new_session(new SpdySession( | 89 std::unique_ptr<SpdySession> new_session(new SpdySession( |
| 90 key, http_server_properties_, transport_security_state_, | 90 key, http_server_properties_, transport_security_state_, |
| 91 verify_domain_authentication_, enable_sending_initial_data_, | 91 verify_domain_authentication_, enable_sending_initial_data_, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 114 if (available_session->GetPeerAddress(&address) == OK) | 114 if (available_session->GetPeerAddress(&address) == OK) |
| 115 aliases_[address] = key; | 115 aliases_[address] = key; |
| 116 } | 116 } |
| 117 | 117 |
| 118 return available_session; | 118 return available_session; |
| 119 } | 119 } |
| 120 | 120 |
| 121 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( | 121 base::WeakPtr<SpdySession> SpdySessionPool::FindAvailableSession( |
| 122 const SpdySessionKey& key, | 122 const SpdySessionKey& key, |
| 123 const GURL& url, | 123 const GURL& url, |
| 124 const BoundNetLog& net_log) { | 124 const NetLogWithSource& net_log) { |
| 125 UnclaimedPushedStreamMap::iterator url_it = | 125 UnclaimedPushedStreamMap::iterator url_it = |
| 126 unclaimed_pushed_streams_.find(url); | 126 unclaimed_pushed_streams_.find(url); |
| 127 if (!url.is_empty() && url_it != unclaimed_pushed_streams_.end()) { | 127 if (!url.is_empty() && url_it != unclaimed_pushed_streams_.end()) { |
| 128 DCHECK(url.SchemeIsCryptographic()); | 128 DCHECK(url.SchemeIsCryptographic()); |
| 129 for (WeakSessionList::iterator it = url_it->second.begin(); | 129 for (WeakSessionList::iterator it = url_it->second.begin(); |
| 130 it != url_it->second.end();) { | 130 it != url_it->second.end();) { |
| 131 base::WeakPtr<SpdySession> spdy_session = *it; | 131 base::WeakPtr<SpdySession> spdy_session = *it; |
| 132 // Lazy deletion of destroyed SpdySessions. | 132 // Lazy deletion of destroyed SpdySessions. |
| 133 if (!spdy_session) { | 133 if (!spdy_session) { |
| 134 it = url_it->second.erase(it); | 134 it = url_it->second.erase(it); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 438 |
| 439 if (idle_only && (*it)->is_active()) | 439 if (idle_only && (*it)->is_active()) |
| 440 continue; | 440 continue; |
| 441 | 441 |
| 442 (*it)->CloseSessionOnError(error, description); | 442 (*it)->CloseSessionOnError(error, description); |
| 443 DCHECK(!IsSessionAvailable(*it)); | 443 DCHECK(!IsSessionAvailable(*it)); |
| 444 } | 444 } |
| 445 } | 445 } |
| 446 | 446 |
| 447 } // namespace net | 447 } // namespace net |
| OLD | NEW |