| 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/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| 11 #include "base/profiler/scoped_tracker.h" | 11 #include "base/profiler/scoped_tracker.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/trace_event/memory_allocator_dump.h" |
| 15 #include "base/trace_event/process_memory_dump.h" |
| 13 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
| 14 #include "base/values.h" | 17 #include "base/values.h" |
| 15 #include "net/base/address_list.h" | 18 #include "net/base/address_list.h" |
| 16 #include "net/base/trace_constants.h" | 19 #include "net/base/trace_constants.h" |
| 17 #include "net/http/http_network_session.h" | 20 #include "net/http/http_network_session.h" |
| 18 #include "net/http/http_server_properties.h" | 21 #include "net/http/http_server_properties.h" |
| 19 #include "net/log/net_log_event_type.h" | 22 #include "net/log/net_log_event_type.h" |
| 20 #include "net/log/net_log_source.h" | 23 #include "net/log/net_log_source.h" |
| 21 #include "net/log/net_log_with_source.h" | 24 #include "net/log/net_log_with_source.h" |
| 22 #include "net/spdy/spdy_session.h" | 25 #include "net/spdy/spdy_session.h" |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 } | 359 } |
| 357 | 360 |
| 358 void SpdySessionPool::OnSSLConfigChanged() { | 361 void SpdySessionPool::OnSSLConfigChanged() { |
| 359 CloseCurrentSessions(ERR_NETWORK_CHANGED); | 362 CloseCurrentSessions(ERR_NETWORK_CHANGED); |
| 360 } | 363 } |
| 361 | 364 |
| 362 void SpdySessionPool::OnCertDBChanged(const X509Certificate* cert) { | 365 void SpdySessionPool::OnCertDBChanged(const X509Certificate* cert) { |
| 363 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); | 366 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); |
| 364 } | 367 } |
| 365 | 368 |
| 369 void SpdySessionPool::DumpMemoryStats( |
| 370 base::trace_event::ProcessMemoryDump* pmd, |
| 371 const std::string& parent_dump_absolute_name) const { |
| 372 std::string dump_name = base::StringPrintf("%s/spdy_session_pool", |
| 373 parent_dump_absolute_name.c_str()); |
| 374 pmd->CreateAllocatorDump(dump_name); |
| 375 for (const auto& session : sessions_) { |
| 376 session->DumpMemoryStats(pmd, dump_name); |
| 377 } |
| 378 } |
| 379 |
| 366 bool SpdySessionPool::IsSessionAvailable( | 380 bool SpdySessionPool::IsSessionAvailable( |
| 367 const base::WeakPtr<SpdySession>& session) const { | 381 const base::WeakPtr<SpdySession>& session) const { |
| 368 for (AvailableSessionMap::const_iterator it = available_sessions_.begin(); | 382 for (AvailableSessionMap::const_iterator it = available_sessions_.begin(); |
| 369 it != available_sessions_.end(); ++it) { | 383 it != available_sessions_.end(); ++it) { |
| 370 if (it->second.get() == session.get()) | 384 if (it->second.get() == session.get()) |
| 371 return true; | 385 return true; |
| 372 } | 386 } |
| 373 return false; | 387 return false; |
| 374 } | 388 } |
| 375 | 389 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 443 |
| 430 if (idle_only && (*it)->is_active()) | 444 if (idle_only && (*it)->is_active()) |
| 431 continue; | 445 continue; |
| 432 | 446 |
| 433 (*it)->CloseSessionOnError(error, description); | 447 (*it)->CloseSessionOnError(error, description); |
| 434 DCHECK(!IsSessionAvailable(*it)); | 448 DCHECK(!IsSessionAvailable(*it)); |
| 435 } | 449 } |
| 436 } | 450 } |
| 437 | 451 |
| 438 } // namespace net | 452 } // namespace net |
| OLD | NEW |