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

Unified Diff: content/child/child_discardable_shared_memory_manager.cc

Issue 2012763004: [tracing] Only add totals from discardable memory in background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/child/child_discardable_shared_memory_manager.cc
diff --git a/content/child/child_discardable_shared_memory_manager.cc b/content/child/child_discardable_shared_memory_manager.cc
index 1bb4ac5af4a0b44e0ea6d4d145336df9c79467b1..a0236a40ca7a2686a5dd86c80345455adc36ab3f 100644
--- a/content/child/child_discardable_shared_memory_manager.cc
+++ b/content/child/child_discardable_shared_memory_manager.cc
@@ -214,6 +214,21 @@ bool ChildDiscardableSharedMemoryManager::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
base::AutoLock lock(lock_);
+ if (args.level_of_detail ==
+ base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
+ base::trace_event::MemoryAllocatorDump* total_dump =
+ pmd->CreateAllocatorDump("discardable");
+ const size_t total_size = heap_.GetSize();
+ const size_t freelist_size = heap_.GetSizeOfFreeLists();
+ total_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ total_size - freelist_size);
+ total_dump->AddScalar("freelist_size",
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ freelist_size);
+ return true;
+ }
+
return heap_.OnMemoryDump(pmd);
}

Powered by Google App Engine
This is Rietveld 408576698