diff options
author | ssid <ssid@chromium.org> | 2015-10-23 10:49:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-10-23 10:49:35 -0700 |
commit | 93775bd279e7db34f074ce9820531663fa708696 (patch) | |
tree | d836b14b6190fcf95159a88be521f1fe5df0aa7f /src/core/SkGlyphCache.cpp | |
parent | 546dc3294d6ad17bdaae40430e799ea33acfe943 (diff) |
[tracing] Remove counter logic and just use address on glyph cache dumps
This CL removes the logic of counting the index of glyphs and uses the
address of the glyph object for dump name. This makes the dump names
consistent across multiple dumps.
BUG=543479
Review URL: https://codereview.chromium.org/1425443002
Diffstat (limited to 'src/core/SkGlyphCache.cpp')
-rw-r--r-- | src/core/SkGlyphCache.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 4ecbe2eda2..91e53c4df1 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -19,15 +19,7 @@ //#define SPEW_PURGE_STATUS namespace { - const char gGlyphCacheDumpName[] = "skia/sk_glyph_cache"; - -// Used to pass context to the sk_trace_dump_visitor. -struct SkGlyphCacheDumpContext { - int* counter; - SkTraceMemoryDump* dump; -}; - } // namespace // Returns the shared globals @@ -433,11 +425,7 @@ void SkGlyphCache::Dump() { } static void sk_trace_dump_visitor(const SkGlyphCache& cache, void* context) { - SkGlyphCacheDumpContext* dumpContext = static_cast<SkGlyphCacheDumpContext*>(context); - SkTraceMemoryDump* dump = dumpContext->dump; - int* counter = dumpContext->counter; - int index = *counter; - *counter += 1; + SkTraceMemoryDump* dump = static_cast<SkTraceMemoryDump*>(context); const SkTypeface* face = cache.getScalerContext()->getTypeface(); const SkScalerContextRec& rec = cache.getScalerContext()->getRec(); @@ -451,8 +439,8 @@ static void sk_trace_dump_visitor(const SkGlyphCache& cache, void* context) { } } - SkString dumpName = SkStringPrintf("%s/%s_%d/index_%d", - gGlyphCacheDumpName, fontName.c_str(), rec.fFontID, index); + SkString dumpName = SkStringPrintf("%s/%s_%d/%p", + gGlyphCacheDumpName, fontName.c_str(), rec.fFontID, &cache); dump->dumpNumericValue(dumpName.c_str(), "size", "bytes", cache.getMemoryUsed()); dump->dumpNumericValue(dumpName.c_str(), "glyph_count", "objects", cache.countCachedGlyphs()); @@ -473,9 +461,7 @@ void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { return; } - int counter = 0; - SkGlyphCacheDumpContext context = { &counter, dump }; - SkGlyphCache::VisitAll(sk_trace_dump_visitor, &context); + SkGlyphCache::VisitAll(sk_trace_dump_visitor, dump); } void SkGlyphCache::VisitAll(Visitor visitor, void* context) { |