| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 const SpdySessionKey& spdy_session_key) { | 244 const SpdySessionKey& spdy_session_key) { |
| 245 SpdySessionList* list = GetSessionList(spdy_session_key); | 245 SpdySessionList* list = GetSessionList(spdy_session_key); |
| 246 if (!list) | 246 if (!list) |
| 247 return false; | 247 return false; |
| 248 list->remove(session); | 248 list->remove(session); |
| 249 if (list->empty()) | 249 if (list->empty()) |
| 250 RemoveSessionList(spdy_session_key); | 250 RemoveSessionList(spdy_session_key); |
| 251 return true; | 251 return true; |
| 252 } | 252 } |
| 253 | 253 |
| 254 Value* SpdySessionPool::SpdySessionPoolInfoToValue() const { | 254 base::Value* SpdySessionPool::SpdySessionPoolInfoToValue() const { |
| 255 ListValue* list = new ListValue(); | 255 base::ListValue* list = new base::ListValue(); |
| 256 | 256 |
| 257 for (SpdySessionsMap::const_iterator it = sessions_.begin(); | 257 for (SpdySessionsMap::const_iterator it = sessions_.begin(); |
| 258 it != sessions_.end(); ++it) { | 258 it != sessions_.end(); ++it) { |
| 259 SpdySessionList* sessions = it->second; | 259 SpdySessionList* sessions = it->second; |
| 260 for (SpdySessionList::const_iterator session = sessions->begin(); | 260 for (SpdySessionList::const_iterator session = sessions->begin(); |
| 261 session != sessions->end(); ++session) { | 261 session != sessions->end(); ++session) { |
| 262 // Only add the session if the key in the map matches the main | 262 // Only add the session if the key in the map matches the main |
| 263 // host_port_proxy_pair (not an alias). | 263 // host_port_proxy_pair (not an alias). |
| 264 const SpdySessionKey& key = it->first; | 264 const SpdySessionKey& key = it->first; |
| 265 const SpdySessionKey& session_key = session->get()->spdy_session_key(); | 265 const SpdySessionKey& session_key = session->get()->spdy_session_key(); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 | 493 |
| 494 SpdySessionKey key(map_it->first); | 494 SpdySessionKey key(map_it->first); |
| 495 session->CloseSessionOnError( | 495 session->CloseSessionOnError( |
| 496 net::ERR_ABORTED, true, "Closing idle sessions."); | 496 net::ERR_ABORTED, true, "Closing idle sessions."); |
| 497 // CloseSessionOnError can invalidate the iterator. | 497 // CloseSessionOnError can invalidate the iterator. |
| 498 map_it = sessions_.lower_bound(key); | 498 map_it = sessions_.lower_bound(key); |
| 499 } | 499 } |
| 500 } | 500 } |
| 501 | 501 |
| 502 } // namespace net | 502 } // namespace net |
| OLD | NEW |