| 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..089711796b0f9284e202afd4e84f1c7c2fe6f8e2 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_memory_allocator.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,24 @@ 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 =
|
| + SkResourceCache::GetDiscardableFactory()
|
| + ? base::DiscardableMemoryAllocator::GetMemoryPoolNameForTracing()
|
| + : base::trace_event::MemoryDumpManager::GetInstance()
|
| + ->system_allocator_pool_name();
|
| + process_memory_dump->AddSuballocation(resource_mad->guid(), source_name);
|
|
|
| return true;
|
| }
|
|
|