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

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

Issue 2639403005: Skip creating spdy_session_pool dump if pool is empty in MemoryDumpProvider (Closed)
Patch Set: early return Created 3 years, 11 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
« no previous file with comments | « no previous file | 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) 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 CloseCurrentSessions(ERR_NETWORK_CHANGED); 364 CloseCurrentSessions(ERR_NETWORK_CHANGED);
365 } 365 }
366 366
367 void SpdySessionPool::OnCertDBChanged(const X509Certificate* cert) { 367 void SpdySessionPool::OnCertDBChanged(const X509Certificate* cert) {
368 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED); 368 CloseCurrentSessions(ERR_CERT_DATABASE_CHANGED);
369 } 369 }
370 370
371 void SpdySessionPool::DumpMemoryStats( 371 void SpdySessionPool::DumpMemoryStats(
372 base::trace_event::ProcessMemoryDump* pmd, 372 base::trace_event::ProcessMemoryDump* pmd,
373 const std::string& parent_dump_absolute_name) const { 373 const std::string& parent_dump_absolute_name) const {
374 std::string dump_name = base::StringPrintf("%s/spdy_session_pool", 374 if (sessions_.empty())
375 parent_dump_absolute_name.c_str()); 375 return;
376 base::trace_event::MemoryAllocatorDump* dump =
377 pmd->CreateAllocatorDump(dump_name);
378 size_t total_size = 0; 376 size_t total_size = 0;
379 size_t buffer_size = 0; 377 size_t buffer_size = 0;
380 size_t cert_count = 0; 378 size_t cert_count = 0;
381 size_t serialized_cert_size = 0; 379 size_t serialized_cert_size = 0;
382 size_t num_active_sessions = 0; 380 size_t num_active_sessions = 0;
383 for (const auto& session : sessions_) { 381 for (const auto& session : sessions_) {
384 StreamSocket::SocketMemoryStats stats; 382 StreamSocket::SocketMemoryStats stats;
385 bool is_session_active = false; 383 bool is_session_active = false;
386 session->DumpMemoryStats(&stats, &is_session_active); 384 session->DumpMemoryStats(&stats, &is_session_active);
387 total_size += stats.total_size; 385 total_size += stats.total_size;
388 buffer_size += stats.buffer_size; 386 buffer_size += stats.buffer_size;
389 cert_count += stats.cert_count; 387 cert_count += stats.cert_count;
390 serialized_cert_size += stats.serialized_cert_size; 388 serialized_cert_size += stats.serialized_cert_size;
391 if (is_session_active) 389 if (is_session_active)
392 num_active_sessions++; 390 num_active_sessions++;
393 } 391 }
392 base::trace_event::MemoryAllocatorDump* dump =
393 pmd->CreateAllocatorDump(base::StringPrintf(
394 "%s/spdy_session_pool", parent_dump_absolute_name.c_str()));
394 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, 395 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
395 base::trace_event::MemoryAllocatorDump::kUnitsBytes, 396 base::trace_event::MemoryAllocatorDump::kUnitsBytes,
396 total_size); 397 total_size);
397 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount, 398 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
398 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 399 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
399 sessions_.size()); 400 sessions_.size());
400 dump->AddScalar("active_session_count", 401 dump->AddScalar("active_session_count",
401 base::trace_event::MemoryAllocatorDump::kUnitsObjects, 402 base::trace_event::MemoryAllocatorDump::kUnitsObjects,
402 num_active_sessions); 403 num_active_sessions);
403 dump->AddScalar("buffer_size", 404 dump->AddScalar("buffer_size",
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 478
478 if (idle_only && (*it)->is_active()) 479 if (idle_only && (*it)->is_active())
479 continue; 480 continue;
480 481
481 (*it)->CloseSessionOnError(error, description); 482 (*it)->CloseSessionOnError(error, description);
482 DCHECK(!IsSessionAvailable(*it)); 483 DCHECK(!IsSessionAvailable(*it));
483 } 484 }
484 } 485 }
485 486
486 } // namespace net 487 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698