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/logging.h" | 7 #include "base/logging.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 true /* idle_only */); | 241 true /* idle_only */); |
242 } | 242 } |
243 | 243 |
244 void SpdySessionPool::CloseAllSessions() { | 244 void SpdySessionPool::CloseAllSessions() { |
245 while (!available_sessions_.empty()) { | 245 while (!available_sessions_.empty()) { |
246 CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.", | 246 CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.", |
247 false /* idle_only */); | 247 false /* idle_only */); |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 base::Value* SpdySessionPool::SpdySessionPoolInfoToValue() const { | 251 scoped_ptr<base::Value> SpdySessionPool::SpdySessionPoolInfoToValue() const { |
252 base::ListValue* list = new base::ListValue(); | 252 scoped_ptr<base::ListValue> list(new base::ListValue()); |
253 | 253 |
254 for (AvailableSessionMap::const_iterator it = available_sessions_.begin(); | 254 for (AvailableSessionMap::const_iterator it = available_sessions_.begin(); |
255 it != available_sessions_.end(); ++it) { | 255 it != available_sessions_.end(); ++it) { |
256 // Only add the session if the key in the map matches the main | 256 // Only add the session if the key in the map matches the main |
257 // host_port_proxy_pair (not an alias). | 257 // host_port_proxy_pair (not an alias). |
258 const SpdySessionKey& key = it->first; | 258 const SpdySessionKey& key = it->first; |
259 const SpdySessionKey& session_key = it->second->spdy_session_key(); | 259 const SpdySessionKey& session_key = it->second->spdy_session_key(); |
260 if (key.Equals(session_key)) | 260 if (key.Equals(session_key)) |
261 list->Append(it->second->GetInfoAsValue()); | 261 list->Append(it->second->GetInfoAsValue()); |
262 } | 262 } |
263 return list; | 263 return list.Pass(); |
264 } | 264 } |
265 | 265 |
266 void SpdySessionPool::OnIPAddressChanged() { | 266 void SpdySessionPool::OnIPAddressChanged() { |
267 WeakSessionList current_sessions = GetCurrentSessions(); | 267 WeakSessionList current_sessions = GetCurrentSessions(); |
268 for (WeakSessionList::const_iterator it = current_sessions.begin(); | 268 for (WeakSessionList::const_iterator it = current_sessions.begin(); |
269 it != current_sessions.end(); ++it) { | 269 it != current_sessions.end(); ++it) { |
270 if (!*it) | 270 if (!*it) |
271 continue; | 271 continue; |
272 | 272 |
273 // For OSs that terminate TCP connections upon relevant network changes, | 273 // For OSs that terminate TCP connections upon relevant network changes, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 | 370 |
371 if (idle_only && (*it)->is_active()) | 371 if (idle_only && (*it)->is_active()) |
372 continue; | 372 continue; |
373 | 373 |
374 (*it)->CloseSessionOnError(error, description); | 374 (*it)->CloseSessionOnError(error, description); |
375 DCHECK(!IsSessionAvailable(*it)); | 375 DCHECK(!IsSessionAvailable(*it)); |
376 } | 376 } |
377 } | 377 } |
378 | 378 |
379 } // namespace net | 379 } // namespace net |
OLD | NEW |