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

Unified Diff: content/common/discardable_shared_memory_heap.cc

Issue 1583483002: [tracing] Add method to create "weak" global dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: back to weak dumps. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/common/discardable_shared_memory_heap.cc
diff --git a/content/common/discardable_shared_memory_heap.cc b/content/common/discardable_shared_memory_heap.cc
index 263f83b24ade3e4b2e910681d8446baa7546e4fc..0ef38c9c7454ea7d53897b89ac89da59fca948b3 100644
--- a/content/common/discardable_shared_memory_heap.cc
+++ b/content/common/discardable_shared_memory_heap.cc
@@ -423,14 +423,18 @@ void DiscardableSharedMemoryHeap::OnMemoryDump(
->GetTracingProcessId();
base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid =
GetSegmentGUIDForTracing(tracing_process_id, segment_id);
- pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid);
+ base::trace_event::MemoryAllocatorDump* global_dump =
+ pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid);
+
+ // Set the dump as weak so that it is invalidated if the browser had purged
+ // the segment.
+ global_dump->set_flags(base::trace_event::MemoryAllocatorDump::Flags::WEAK);
petrcermak 2016/01/13 17:46:14 This will work as long as there is no other user o
ssid 2016/01/15 17:14:56 Done.
// The size is added to the global dump so that it gets propagated to both the
// dumps associated.
- pmd->GetSharedGlobalAllocatorDump(shared_segment_guid)
- ->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- allocated_objects_size_in_bytes);
+ global_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ allocated_objects_size_in_bytes);
// By creating an edge with a higher |importance| (w.r.t. browser-side dumps)
// the tracing UI will account the effective size of the segment to the child.
« base/trace_event/memory_allocator_dump.h ('K') | « base/trace_event/memory_allocator_dump.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698