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

Unified Diff: skia/ext/skia_memory_dump_provider.cc

Issue 1259333003: [tracing] Add SkResourceCache as suballocation to avoid double counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skia_v1
Patch Set: Removing segment dump from base. Created 5 years, 5 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
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698