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

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

Issue 6526059: Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Appease the C++ type system Created 9 years, 9 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
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/logging.h" 7 #include "base/logging.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "net/http/http_network_session.h" 9 #include "net/http/http_network_session.h"
10 #include "net/spdy/spdy_session.h" 10 #include "net/spdy/spdy_session.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 // The maximum number of sessions to open to a single domain. 14 // The maximum number of sessions to open to a single domain.
15 static const size_t kMaxSessionsPerDomain = 1; 15 static const size_t kMaxSessionsPerDomain = 1;
16 16
17 int SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain; 17 int SpdySessionPool::g_max_sessions_per_domain = kMaxSessionsPerDomain;
18 bool SpdySessionPool::g_force_single_domain = false; 18 bool SpdySessionPool::g_force_single_domain = false;
19 19
20 SpdySessionPool::SpdySessionPool(SSLConfigService* ssl_config_service) 20 SpdySessionPool::SpdySessionPool(SSLConfigService* ssl_config_service)
21 : ssl_config_service_(ssl_config_service) { 21 : ssl_config_service_(ssl_config_service) {
22 NetworkChangeNotifier::AddObserver(this); 22 NetworkChangeNotifier::AddIPAddressObserver(this);
23 if (ssl_config_service_) 23 if (ssl_config_service_)
24 ssl_config_service_->AddObserver(this); 24 ssl_config_service_->AddObserver(this);
25 } 25 }
26 26
27 SpdySessionPool::~SpdySessionPool() { 27 SpdySessionPool::~SpdySessionPool() {
28 CloseAllSessions(); 28 CloseAllSessions();
29 29
30 if (ssl_config_service_) 30 if (ssl_config_service_)
31 ssl_config_service_->RemoveObserver(this); 31 ssl_config_service_->RemoveObserver(this);
32 NetworkChangeNotifier::RemoveObserver(this); 32 NetworkChangeNotifier::RemoveIPAddressObserver(this);
33 } 33 }
34 34
35 scoped_refptr<SpdySession> SpdySessionPool::Get( 35 scoped_refptr<SpdySession> SpdySessionPool::Get(
36 const HostPortProxyPair& host_port_proxy_pair, 36 const HostPortProxyPair& host_port_proxy_pair,
37 const BoundNetLog& net_log) { 37 const BoundNetLog& net_log) {
38 scoped_refptr<SpdySession> spdy_session; 38 scoped_refptr<SpdySession> spdy_session;
39 SpdySessionList* list = GetSessionList(host_port_proxy_pair); 39 SpdySessionList* list = GetSessionList(host_port_proxy_pair);
40 if (list) { 40 if (list) {
41 if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) { 41 if (list->size() >= static_cast<unsigned int>(g_max_sessions_per_domain)) {
42 spdy_session = list->front(); 42 spdy_session = list->front();
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 session->CloseSessionOnError(net::ERR_ABORTED, false); 214 session->CloseSessionOnError(net::ERR_ABORTED, false);
215 list->pop_front(); 215 list->pop_front();
216 if (list->empty()) { 216 if (list->empty()) {
217 delete list; 217 delete list;
218 old_map.erase(old_map.begin()->first); 218 old_map.erase(old_map.begin()->first);
219 } 219 }
220 } 220 }
221 } 221 }
222 222
223 } // namespace net 223 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_session_pool.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698