Index: base/memory/discardable_memory_allocator.cc |
diff --git a/base/memory/discardable_memory_allocator.cc b/base/memory/discardable_memory_allocator.cc |
index 002a3ba5e4763c360dc0a96861d0c53758bdb3bc..99363fe40dfcaa9fbc6124258f2526b9b6be85a3 100644 |
--- a/base/memory/discardable_memory_allocator.cc |
+++ b/base/memory/discardable_memory_allocator.cc |
@@ -5,6 +5,8 @@ |
#include "base/memory/discardable_memory_allocator.h" |
#include "base/logging.h" |
+#include "base/trace_event/memory_allocator_dump.h" |
+#include "base/trace_event/process_memory_dump.h" |
namespace base { |
namespace { |
@@ -31,4 +33,24 @@ DiscardableMemoryAllocator* DiscardableMemoryAllocator::GetInstance() { |
return g_allocator; |
} |
+// static |
+const char* DiscardableMemoryAllocator::GetMemoryPoolNameForTracing() { |
+ return "discardable/allocated_objects"; |
+} |
+ |
+// static |
+void DiscardableMemoryAllocator::CreateMemoryPoolDumpForTracing( |
+ trace_event::ProcessMemoryDump* pmd) { |
+ base::trace_event::MemoryAllocatorDump* objects_dump = |
+ pmd->CreateAllocatorDump(GetMemoryPoolNameForTracing()); |
+ base::trace_event::MemoryAllocatorDump* discardable_segments_dump = |
+ pmd->CreateAllocatorDump("discardable/segments"); |
reveman
2015/07/30 21:27:56
The use of segments is a detail of the allocator i
ssid
2015/07/31 12:59:40
Done.
|
+ |
+ // The discardable memory segments will be dumped with |
+ // "discardable/segments" as the parent and will be owned by |
+ // sub-allocations dumped with kAllocatedObjectsDumpName as their parent. |
+ pmd->AddOwnershipEdge(objects_dump->guid(), |
+ discardable_segments_dump->guid()); |
reveman
2015/07/30 21:27:56
same here. we shouldn't be referring to segments h
ssid
2015/07/31 12:59:40
Done.
|
+} |
+ |
} // namespace base |