Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1189)

Side by Side Diff: net/spdy/spdy_session_pool.cc

Issue 11620007: Switch from OnIPAddressChanged and OnConnectionTypeChange to OnNetworkChanged Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 enable_compression_(enable_compression), 66 enable_compression_(enable_compression),
67 enable_ping_based_connection_checking_( 67 enable_ping_based_connection_checking_(
68 enable_ping_based_connection_checking), 68 enable_ping_based_connection_checking),
69 default_protocol_(default_protocol), 69 default_protocol_(default_protocol),
70 initial_recv_window_size_(initial_recv_window_size), 70 initial_recv_window_size_(initial_recv_window_size),
71 initial_max_concurrent_streams_(initial_max_concurrent_streams), 71 initial_max_concurrent_streams_(initial_max_concurrent_streams),
72 max_concurrent_streams_limit_(max_concurrent_streams_limit), 72 max_concurrent_streams_limit_(max_concurrent_streams_limit),
73 time_func_(time_func), 73 time_func_(time_func),
74 trusted_spdy_proxy_( 74 trusted_spdy_proxy_(
75 HostPortPair::FromString(trusted_spdy_proxy)) { 75 HostPortPair::FromString(trusted_spdy_proxy)) {
76 NetworkChangeNotifier::AddIPAddressObserver(this); 76 NetworkChangeNotifier::AddNetworkChangeObserver(this);
77 if (ssl_config_service_) 77 if (ssl_config_service_)
78 ssl_config_service_->AddObserver(this); 78 ssl_config_service_->AddObserver(this);
79 CertDatabase::GetInstance()->AddObserver(this); 79 CertDatabase::GetInstance()->AddObserver(this);
80 } 80 }
81 81
82 SpdySessionPool::~SpdySessionPool() { 82 SpdySessionPool::~SpdySessionPool() {
83 CloseAllSessions(); 83 CloseAllSessions();
84 84
85 if (ssl_config_service_) 85 if (ssl_config_service_)
86 ssl_config_service_->RemoveObserver(this); 86 ssl_config_service_->RemoveObserver(this);
87 NetworkChangeNotifier::RemoveIPAddressObserver(this); 87 NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
88 CertDatabase::GetInstance()->RemoveObserver(this); 88 CertDatabase::GetInstance()->RemoveObserver(this);
89 } 89 }
90 90
91 scoped_refptr<SpdySession> SpdySessionPool::Get( 91 scoped_refptr<SpdySession> SpdySessionPool::Get(
92 const HostPortProxyPair& host_port_proxy_pair, 92 const HostPortProxyPair& host_port_proxy_pair,
93 const BoundNetLog& net_log) { 93 const BoundNetLog& net_log) {
94 return GetInternal(host_port_proxy_pair, net_log, false); 94 return GetInternal(host_port_proxy_pair, net_log, false);
95 } 95 }
96 96
97 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists( 97 scoped_refptr<SpdySession> SpdySessionPool::GetIfExists(
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // host_port_proxy_pair (not an alias). 267 // host_port_proxy_pair (not an alias).
268 const HostPortProxyPair& key = it->first; 268 const HostPortProxyPair& key = it->first;
269 const HostPortProxyPair& pair = session->get()->host_port_proxy_pair(); 269 const HostPortProxyPair& pair = session->get()->host_port_proxy_pair();
270 if (key.first.Equals(pair.first) && key.second == pair.second) 270 if (key.first.Equals(pair.first) && key.second == pair.second)
271 list->Append(session->get()->GetInfoAsValue()); 271 list->Append(session->get()->GetInfoAsValue());
272 } 272 }
273 } 273 }
274 return list; 274 return list;
275 } 275 }
276 276
277 void SpdySessionPool::OnIPAddressChanged() { 277 void SpdySessionPool::OnNetworkChanged(
278 CloseCurrentSessions(ERR_NETWORK_CHANGED); 278 net::NetworkChangeNotifier::ConnectionType type) {
279 http_server_properties_->ClearSpdySettings(); 279 if (type == net::NetworkChangeNotifier::CONNECTION_NONE) {
280 CloseCurrentSessions(ERR_NETWORK_CHANGED);
281 http_server_properties_->ClearSpdySettings();
282 }
280 } 283 }
281 284
282 void SpdySessionPool::OnSSLConfigChanged() { 285 void SpdySessionPool::OnSSLConfigChanged() {
283 CloseCurrentSessions(ERR_NETWORK_CHANGED); 286 CloseCurrentSessions(ERR_NETWORK_CHANGED);
284 } 287 }
285 288
286 scoped_refptr<SpdySession> SpdySessionPool::GetExistingSession( 289 scoped_refptr<SpdySession> SpdySessionPool::GetExistingSession(
287 SpdySessionList* list, 290 SpdySessionList* list,
288 const BoundNetLog& net_log) const { 291 const BoundNetLog& net_log) const {
289 DCHECK(list); 292 DCHECK(list);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 const scoped_refptr<SpdySession>& session = *session_it; 491 const scoped_refptr<SpdySession>& session = *session_it;
489 CHECK(session); 492 CHECK(session);
490 if (!session->is_active()) { 493 if (!session->is_active()) {
491 session->CloseSessionOnError( 494 session->CloseSessionOnError(
492 net::ERR_ABORTED, true, "Closing idle sessions."); 495 net::ERR_ABORTED, true, "Closing idle sessions.");
493 } 496 }
494 } 497 }
495 } 498 }
496 499
497 } // namespace net 500 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698