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

Unified Diff: net/ssl/ssl_client_session_cache.cc

Issue 2574513002: Do not create sub MemoryAllocatorDumps in SSLClientSessionCache (Closed)
Patch Set: Address comment Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/ssl/ssl_client_session_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/ssl/ssl_client_session_cache.cc
diff --git a/net/ssl/ssl_client_session_cache.cc b/net/ssl/ssl_client_session_cache.cc
index 5fd3c481ef02777906092a07e166405f2646e408..19b9d556a13c9c0c2f9d15f00a835f44254ba2e1 100644
--- a/net/ssl/ssl_client_session_cache.cc
+++ b/net/ssl/ssl_client_session_cache.cc
@@ -98,31 +98,30 @@ void SSLClientSessionCache::DumpMemoryStats(
return;
cache_dump = pmd->CreateAllocatorDump(absolute_name);
base::AutoLock lock(lock_);
+ int total_serialized_cert_size = 0;
+ int total_cert_count = 0;
for (const auto& pair : cache_) {
auto entry = pair.second.get();
auto cert_chain = entry->x509_chain;
size_t cert_count = sk_X509_num(cert_chain);
- base::trace_event::MemoryAllocatorDump* entry_dump =
- pmd->CreateAllocatorDump(
- base::StringPrintf("%s/entry_%p", absolute_name.c_str(), entry));
- int cert_size = 0;
+ total_cert_count += cert_count;
for (size_t i = 0; i < cert_count; ++i) {
X509* cert = sk_X509_value(cert_chain, i);
- cert_size += i2d_X509(cert, nullptr);
+ total_serialized_cert_size += i2d_X509(cert, nullptr);
}
- // This measures the lower bound of the serialized certificate. It doesn't
- // measure the actual memory used, which is 4x this amount (see
- // crbug.com/671420 for more details).
- entry_dump->AddScalar("cert_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- cert_size);
- entry_dump->AddScalar("serialized_cert_count",
- base::trace_event::MemoryAllocatorDump::kUnitsObjects,
- cert_count);
- entry_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- cert_size);
}
+ // This measures the lower bound of the serialized certificate. It doesn't
+ // measure the actual memory used, which is 4x this amount (see
+ // crbug.com/671420 for more details).
+ cache_dump->AddScalar("serialized_cert_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ total_serialized_cert_size);
+ cache_dump->AddScalar("cert_count",
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects,
+ total_cert_count);
+ cache_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ total_serialized_cert_size);
}
void SSLClientSessionCache::FlushExpiredSessions() {
« no previous file with comments | « no previous file | net/ssl/ssl_client_session_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698