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

Unified Diff: skia/ext/skia_memory_dump_provider.cc

Issue 2015763003: [tracing] Support background mode in skia memory dump provider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Created 4 years, 7 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 | « no previous file | 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 e0767526beacb4c293351dc9b401fbd7df7fabc1..c53cf7e62da82df8684a22fad8e2ef8ff142f47d 100644
--- a/skia/ext/skia_memory_dump_provider.cc
+++ b/skia/ext/skia_memory_dump_provider.cc
@@ -26,6 +26,22 @@ SkiaMemoryDumpProvider::~SkiaMemoryDumpProvider() {}
bool SkiaMemoryDumpProvider::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* process_memory_dump) {
+ if (args.level_of_detail ==
+ base::trace_event::MemoryDumpLevelOfDetail::BACKGROUND) {
+ auto glyph_cache_dump =
+ process_memory_dump->CreateAllocatorDump("skia/sk_glyph_cache");
+ glyph_cache_dump->AddScalar(
+ base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ SkGraphics::GetFontCacheUsed());
+ auto resource_cache_dump =
+ process_memory_dump->CreateAllocatorDump("skia/sk_resource_cache");
+ resource_cache_dump->AddScalar(
+ base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ SkGraphics::GetResourceCacheTotalBytesUsed());
+ return true;
+ }
SkiaTraceMemoryDumpImpl skia_dumper(args.level_of_detail,
process_memory_dump);
SkGraphics::DumpMemoryStatistics(&skia_dumper);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698