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

Unified Diff: src/core/SkGlyphCache.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 | « include/core/SkTraceMemoryDump.h ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyphCache.cpp
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
index 9bee4e5f757381be74089122555bbc881e5a1423..3f64d6ed48bc0fea8abaa55c44a72c3083f77f88 100644
--- a/src/core/SkGlyphCache.cpp
+++ b/src/core/SkGlyphCache.cpp
@@ -427,16 +427,16 @@ static void sk_trace_dump_visitor(const SkGlyphCache& cache, void* context) {
*counter += 1;
const SkTypeface* face = cache.getScalerContext()->getTypeface();
- SkString font_name;
- face->getFamilyName(&font_name);
+ SkString fontName;
+ face->getFamilyName(&fontName);
const SkScalerContextRec& rec = cache.getScalerContext()->getRec();
- SkString dump_name = SkStringPrintf("%s/%s_%3d/index_%d",
- gGlyphCacheDumpName, font_name.c_str(), rec.fFontID, index);
+ SkString dumpName = SkStringPrintf("%s/%s_%3d/index_%d",
+ gGlyphCacheDumpName, fontName.c_str(), rec.fFontID, index);
- dump->dumpNumericValue(dump_name.c_str(), "size", "bytes", cache.getMemoryUsed());
- dump->dumpNumericValue(dump_name.c_str(), "glyph_count", "objects", cache.countCachedGlyphs());
- dump->setMemoryBacking(dump_name.c_str(), "malloc", nullptr);
+ dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", cache.getMemoryUsed());
+ dump->dumpNumericValue(dumpName.c_str(), "glyph_count", "objects", cache.countCachedGlyphs());
+ dump->setMemoryBacking(dumpName.c_str(), "malloc", nullptr);
}
void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
@@ -448,6 +448,11 @@ void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
dump->dumpNumericValue(gGlyphCacheDumpName, "budget_glyph_count", "objects",
SkGraphics::GetFontCacheCountLimit());
+ if (dump->getRequestedDetails() == SkTraceMemoryDump::kLight_LevelOfDetail) {
+ dump->setMemoryBacking(gGlyphCacheDumpName, "malloc", nullptr);
+ return;
+ }
+
int counter = 0;
SkGlyphCacheDumpContext context = { &counter, dump };
SkGlyphCache::VisitAll(sk_trace_dump_visitor, &context);
« no previous file with comments | « include/core/SkTraceMemoryDump.h ('k') | src/core/SkResourceCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698