| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 : http_server_properties_(http_server_properties), | 48 : http_server_properties_(http_server_properties), |
| 49 ssl_config_service_(ssl_config_service), | 49 ssl_config_service_(ssl_config_service), |
| 50 resolver_(resolver), | 50 resolver_(resolver), |
| 51 verify_domain_authentication_(true), | 51 verify_domain_authentication_(true), |
| 52 enable_sending_initial_settings_(true), | 52 enable_sending_initial_settings_(true), |
| 53 trusted_spdy_proxy_( | 53 trusted_spdy_proxy_( |
| 54 HostPortPair::FromString(trusted_spdy_proxy)) { | 54 HostPortPair::FromString(trusted_spdy_proxy)) { |
| 55 NetworkChangeNotifier::AddIPAddressObserver(this); | 55 NetworkChangeNotifier::AddIPAddressObserver(this); |
| 56 if (ssl_config_service_) | 56 if (ssl_config_service_) |
| 57 ssl_config_service_->AddObserver(this); | 57 ssl_config_service_->AddObserver(this); |
| 58 CertDatabase::AddObserver(this); | 58 CertDatabase::GetInstance()->AddObserver(this); |
| 59 } | 59 } |
| 60 | 60 |
| 61 SpdySessionPool::~SpdySessionPool() { | 61 SpdySessionPool::~SpdySessionPool() { |
| 62 CloseAllSessions(); | 62 CloseAllSessions(); |
| 63 | 63 |
| 64 if (ssl_config_service_) | 64 if (ssl_config_service_) |
| 65 ssl_config_service_->RemoveObserver(this); | 65 ssl_config_service_->RemoveObserver(this); |
| 66 NetworkChangeNotifier::RemoveIPAddressObserver(this); | 66 NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 67 CertDatabase::RemoveObserver(this); | 67 CertDatabase::GetInstance()->RemoveObserver(this); |
| 68 } | 68 } |
| 69 | 69 |
| 70 scoped_refptr<SpdySession> SpdySessionPool::Get( | 70 scoped_refptr<SpdySession> SpdySessionPool::Get( |
| 71 const HostPortProxyPair& host_port_proxy_pair, | 71 const HostPortProxyPair& host_port_proxy_pair, |
| 72 const BoundNetLog& net_log) { | 72 const BoundNetLog& net_log) { |
| 73 return GetInternal(host_port_proxy_pair, net_log, false); | 73 return GetInternal(host_port_proxy_pair, net_log, false); |
| 74 } | 74 } |
| 75 | 75 |
| 76 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists( | 76 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists( |
| 77 const HostPortProxyPair& host_port_proxy_pair, | 77 const HostPortProxyPair& host_port_proxy_pair, |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 0, 2); | 302 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 0, 2); |
| 303 continue; | 303 continue; |
| 304 } | 304 } |
| 305 if (record_histograms) | 305 if (record_histograms) |
| 306 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 1, 2); | 306 UMA_HISTOGRAM_ENUMERATION("Net.SpdyIPPoolDomainMatch", 1, 2); |
| 307 return spdy_session; | 307 return spdy_session; |
| 308 } | 308 } |
| 309 return NULL; | 309 return NULL; |
| 310 } | 310 } |
| 311 | 311 |
| 312 void SpdySessionPool::OnUserCertAdded(const X509Certificate* cert) { | 312 void SpdySessionPool::OnCertAdded(const X509Certificate* cert) { |
| 313 CloseCurrentSessions(); | 313 CloseCurrentSessions(); |
| 314 } | 314 } |
| 315 | 315 |
| 316 void SpdySessionPool::OnCertTrustChanged(const X509Certificate* cert) { | 316 void SpdySessionPool::OnCertTrustChanged(const X509Certificate* cert) { |
| 317 // Per wtc, we actually only need to CloseCurrentSessions when trust is | 317 // Per wtc, we actually only need to CloseCurrentSessions when trust is |
| 318 // reduced. CloseCurrentSessions now because OnCertTrustChanged does not | 318 // reduced. CloseCurrentSessions now because OnCertTrustChanged does not |
| 319 // tell us this. | 319 // tell us this. |
| 320 // See comments in ClientSocketPoolManager::OnCertTrustChanged. | 320 // See comments in ClientSocketPoolManager::OnCertTrustChanged. |
| 321 CloseCurrentSessions(); | 321 CloseCurrentSessions(); |
| 322 } | 322 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 const scoped_refptr<SpdySession>& session = *session_it; | 452 const scoped_refptr<SpdySession>& session = *session_it; |
| 453 CHECK(session); | 453 CHECK(session); |
| 454 if (!session->is_active()) { | 454 if (!session->is_active()) { |
| 455 session->CloseSessionOnError( | 455 session->CloseSessionOnError( |
| 456 net::ERR_ABORTED, true, "Closing idle sessions."); | 456 net::ERR_ABORTED, true, "Closing idle sessions."); |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace net | 461 } // namespace net |
| OLD | NEW |