| Index: src/core/SkGlyphCache.cpp
|
| diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp
|
| index 309707c66fede82e8ee775b7d545b3984e44001f..3ff263dd8833e359991fe85af7ea89fe918be0cb 100644
|
| --- a/src/core/SkGlyphCache.cpp
|
| +++ b/src/core/SkGlyphCache.cpp
|
| @@ -430,19 +430,23 @@ 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) {
|
| + if (!(dump->getRequestedDetails() | SkTraceMemoryDump::kMemoryTotals |
|
| + SkTraceMemoryDump::kMallocDetails))
|
| + return;
|
| +
|
| dump->dumpNumericValue(gGlyphCacheDumpName, "size", "bytes", SkGraphics::GetFontCacheUsed());
|
| dump->dumpNumericValue(gGlyphCacheDumpName, "budget_size", "bytes",
|
| SkGraphics::GetFontCacheLimit());
|
| @@ -451,6 +455,11 @@ void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
|
| dump->dumpNumericValue(gGlyphCacheDumpName, "budget_glyph_count", "objects",
|
| SkGraphics::GetFontCacheCountLimit());
|
|
|
| + if (!(dump->getRequestedDetails() | SkTraceMemoryDump::kMallocDetails)) {
|
| + dump->setMemoryBacking(gGlyphCacheDumpName, "malloc", nullptr);
|
| + return;
|
| + }
|
| +
|
| int counter = 0;
|
| SkGlyphCacheDumpContext context = { &counter, dump };
|
| SkGlyphCache::VisitAll(sk_trace_dump_visitor, &context);
|
|
|