Chromium Code Reviews| 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..3ade476e2934d04380a2d8d68bc304eebc8ab100 100644 |
| --- a/skia/ext/skia_memory_dump_provider.cc |
| +++ b/skia/ext/skia_memory_dump_provider.cc |
| @@ -26,16 +26,28 @@ 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()); |
| - |
| - auto resource_mad = |
| - process_memory_dump->CreateAllocatorDump("skia/sk_resource_cache"); |
| - resource_mad->AddScalar("size", "bytes", |
| - SkResourceCache::GetTotalBytesUsed()); |
| - // TODO(ssid): crbug.com/503168. Add sub-allocation edges from discardable or |
| - // malloc memory dumps to avoid double counting. |
| - |
| + 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()); |
| + |
| + size_t skia_resource_cache_size = SkResourceCache::GetTotalBytesUsed(); |
| + if (skia_resource_cache_size > 0) { |
|
petrcermak
2015/07/29 11:53:34
Shouldn't we report zero explicitly as well?
ssid
2015/07/29 16:20:51
Yea i think it makes more sense to dump 0
|
| + auto resource_mad = |
| + process_memory_dump->CreateAllocatorDump("skia/sk_resource_cache"); |
| + resource_mad->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| + base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| + skia_resource_cache_size); |
| + if (SkResourceCache::GetDiscardableFactory()) { |
| + process_memory_dump->AddSuballocation(resource_mad->guid(), |
|
petrcermak
2015/07/29 11:53:34
You could use a ternary operator or factor out the
|
| + "discardable/allocated_objects"); |
| + } else { |
| + process_memory_dump->AddSuballocation(resource_mad->guid(), |
| + "malloc/allocated_objects"); |
|
petrcermak
2015/07/29 11:53:34
Please use the base::trace_event::MallocDumpProvid
ssid
2015/07/29 16:20:51
Done.
|
| + } |
| + } |
| return true; |
| } |