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

Unified Diff: src/core/SkResourceCache.cpp

Issue 1310123007: Add support for light dumps in SkTraceMemoryDump interface. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fixing typo. 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 | « src/core/SkGlyphCache.cpp ('k') | tests/TraceMemoryDumpTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkResourceCache.cpp
diff --git a/src/core/SkResourceCache.cpp b/src/core/SkResourceCache.cpp
index 54091f1fd4462e3088c1d7e13031a3202792c04e..a1234e1fef455ea37997b1b96aade5acd75718d4 100644
--- a/src/core/SkResourceCache.cpp
+++ b/src/core/SkResourceCache.cpp
@@ -675,16 +675,18 @@ void SkResourceCache::TestDumpMemoryStatistics() {
static void sk_trace_dump_visitor(const SkResourceCache::Rec& rec, void* context) {
SkTraceMemoryDump* dump = static_cast<SkTraceMemoryDump*>(context);
- SkString dump_name = SkStringPrintf("skia/sk_resource_cache/%s_%p", rec.getCategory(), &rec);
+ SkString dumpName = SkStringPrintf("skia/sk_resource_cache/%s_%p", rec.getCategory(), &rec);
SkDiscardableMemory* discardable = rec.diagnostic_only_getDiscardable();
if (discardable) {
- dump->setDiscardableMemoryBacking(dump_name.c_str(), *discardable);
+ dump->setDiscardableMemoryBacking(dumpName.c_str(), *discardable);
} else {
- dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", rec.bytesUsed());
- dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr);
+ dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", rec.bytesUsed());
+ dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr);
}
}
void SkResourceCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
+ // Since resource could be backed by malloc or discardable, the cache always dumps detailed
+ // stats to be accurate.
VisitAll(sk_trace_dump_visitor, dump);
}
« no previous file with comments | « src/core/SkGlyphCache.cpp ('k') | tests/TraceMemoryDumpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698