Index: skia/ext/skia_memory_dump_provider.cc |
diff --git a/skia/ext/skia_memory_dump_provider.cc b/skia/ext/skia_memory_dump_provider.cc |
index a7c445fd5d4f1f9b34865ac3162a3b7bf0a1688e..bada1da4b4aac3f152abe202a12be3be1fb5002e 100644 |
--- a/skia/ext/skia_memory_dump_provider.cc |
+++ b/skia/ext/skia_memory_dump_provider.cc |
@@ -4,6 +4,8 @@ |
#include "skia_memory_dump_provider.h" |
+#include "base/memory/discardable_shared_memory.h" |
+#include "base/trace_event/malloc_dump_provider.h" |
#include "base/trace_event/memory_allocator_dump.h" |
#include "base/trace_event/memory_dump_manager.h" |
#include "base/trace_event/process_memory_dump.h" |
@@ -26,15 +28,23 @@ bool SkiaMemoryDumpProvider::OnMemoryDump( |
base::trace_event::ProcessMemoryDump* process_memory_dump) { |
auto font_mad = |
process_memory_dump->CreateAllocatorDump("skia/sk_font_cache"); |
- font_mad->AddScalar("size", "bytes", SkGraphics::GetFontCacheUsed()); |
- font_mad->AddScalar("count", "objects", SkGraphics::GetFontCacheCountUsed()); |
+ font_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
+ SkGraphics::GetFontCacheUsed()); |
+ font_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectsCount, |
+ base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
+ SkGraphics::GetFontCacheCountUsed()); |
auto resource_mad = |
process_memory_dump->CreateAllocatorDump("skia/sk_resource_cache"); |
- resource_mad->AddScalar("size", "bytes", |
+ resource_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
SkResourceCache::GetTotalBytesUsed()); |
- // TODO(ssid): crbug.com/503168. Add sub-allocation edges from discardable or |
- // malloc memory dumps to avoid double counting. |
+ const char* source_name = |
reveman
2015/07/30 16:00:59
When discardable memory is not used, shouldn't thi
ssid
2015/07/30 20:05:15
Done.
|
+ SkResourceCache::GetDiscardableFactory() |
+ ? base::DiscardableSharedMemory::kAllocatedObjectsDumpName |
+ : base::trace_event::MallocDumpProvider::kAllocatedObjects; |
reveman
2015/07/29 18:32:11
Can we instead ask the SkResourceCache for the nam
ssid
2015/07/29 19:36:22
Currently the SkResourceCache dump does not includ
reveman
2015/07/29 19:59:23
I'm not following this. What's not possible to see
|
+ process_memory_dump->AddSuballocation(resource_mad->guid(), source_name); |
return true; |
} |