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

Unified Diff: skia/ext/skia_memory_dump_provider.cc

Issue 1319473003: [tracing] Add SkResourceCache statistics to chrome://tracing (chrome side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable_objdumps
Patch Set: Mac build fix. Created 5 years, 3 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 | « skia/ext/SkTraceMemoryDump_chrome.cc ('k') | skia/ext/skia_memory_dump_provider_unittest.cc » ('j') | 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 3944ad40fa3d48b0589678166b49796d6e93e572..1323699ddb1ef54febcb4aadfc8fc16754d77949 100644
--- a/skia/ext/skia_memory_dump_provider.cc
+++ b/skia/ext/skia_memory_dump_provider.cc
@@ -7,6 +7,7 @@
#include "base/trace_event/memory_allocator_dump.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
+#include "skia/ext/SkTraceMemoryDump_chrome.h"
#include "third_party/skia/include/core/SkGraphics.h"
#include "third_party/skia/src/core/SkResourceCache.h"
@@ -25,17 +26,21 @@ SkiaMemoryDumpProvider::~SkiaMemoryDumpProvider() {}
bool SkiaMemoryDumpProvider::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
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.
+ base::trace_event::MemoryAllocatorDump* font_mad =
+ process_memory_dump->CreateAllocatorDump("skia/sk_glyph_cache");
+ 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());
+
+ if (args.level_of_detail ==
+ base::trace_event::MemoryDumpArgs::LevelOfDetail::LOW)
+ return true;
+
+ SkTraceMemoryDump_Chrome skia_dumper(process_memory_dump);
+ SkGraphics::DumpMemoryStatistics(&skia_dumper);
return true;
}
« no previous file with comments | « skia/ext/SkTraceMemoryDump_chrome.cc ('k') | skia/ext/skia_memory_dump_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698