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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 void SpdySessionPool::OnSSLConfigChanged() { | 391 void SpdySessionPool::OnSSLConfigChanged() { |
392 CloseCurrentSessions(ERR_NETWORK_CHANGED); | 392 CloseCurrentSessions(ERR_NETWORK_CHANGED); |
393 } | 393 } |
394 | 394 |
395 void SpdySessionPool::OnCertDBChanged() { | 395 void SpdySessionPool::OnCertDBChanged() { |
396 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); | 396 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); |
397 } | 397 } |
398 | 398 |
399 void SpdySessionPool::DumpMemoryStats( | 399 void SpdySessionPool::DumpMemoryStats( |
400 base::trace_event::ProcessMemoryDump* pmd, | 400 base::trace_event::ProcessMemoryDump* pmd, |
401 const std::string& parent_dump_absolute_name) const { | 401 const SpdyString& parent_dump_absolute_name) const { |
402 if (sessions_.empty()) | 402 if (sessions_.empty()) |
403 return; | 403 return; |
404 size_t total_size = 0; | 404 size_t total_size = 0; |
405 size_t buffer_size = 0; | 405 size_t buffer_size = 0; |
406 size_t cert_count = 0; | 406 size_t cert_count = 0; |
407 size_t cert_size = 0; | 407 size_t cert_size = 0; |
408 size_t num_active_sessions = 0; | 408 size_t num_active_sessions = 0; |
409 for (auto* session : sessions_) { | 409 for (auto* session : sessions_) { |
410 StreamSocket::SocketMemoryStats stats; | 410 StreamSocket::SocketMemoryStats stats; |
411 bool is_session_active = false; | 411 bool is_session_active = false; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 SpdySessionPool::WeakSessionList SpdySessionPool::GetCurrentSessions() const { | 489 SpdySessionPool::WeakSessionList SpdySessionPool::GetCurrentSessions() const { |
490 WeakSessionList current_sessions; | 490 WeakSessionList current_sessions; |
491 for (SessionSet::const_iterator it = sessions_.begin(); | 491 for (SessionSet::const_iterator it = sessions_.begin(); |
492 it != sessions_.end(); ++it) { | 492 it != sessions_.end(); ++it) { |
493 current_sessions.push_back((*it)->GetWeakPtr()); | 493 current_sessions.push_back((*it)->GetWeakPtr()); |
494 } | 494 } |
495 return current_sessions; | 495 return current_sessions; |
496 } | 496 } |
497 | 497 |
498 void SpdySessionPool::CloseCurrentSessionsHelper( | 498 void SpdySessionPool::CloseCurrentSessionsHelper(Error error, |
499 Error error, | 499 const SpdyString& description, |
500 const std::string& description, | 500 bool idle_only) { |
501 bool idle_only) { | |
502 WeakSessionList current_sessions = GetCurrentSessions(); | 501 WeakSessionList current_sessions = GetCurrentSessions(); |
503 for (WeakSessionList::const_iterator it = current_sessions.begin(); | 502 for (WeakSessionList::const_iterator it = current_sessions.begin(); |
504 it != current_sessions.end(); ++it) { | 503 it != current_sessions.end(); ++it) { |
505 if (!*it) | 504 if (!*it) |
506 continue; | 505 continue; |
507 | 506 |
508 if (idle_only && (*it)->is_active()) | 507 if (idle_only && (*it)->is_active()) |
509 continue; | 508 continue; |
510 | 509 |
511 (*it)->CloseSessionOnError(error, description); | 510 (*it)->CloseSessionOnError(error, description); |
512 DCHECK(!IsSessionAvailable(*it)); | 511 DCHECK(!IsSessionAvailable(*it)); |
513 } | 512 } |
514 } | 513 } |
515 | 514 |
516 } // namespace net | 515 } // namespace net |
OLD | NEW |