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

Unified Diff: src/core/SkGlyphCache.cpp

Issue 1425443002: [tracing] Remove counter logic and just use address on glyph cache dumps (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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 4ecbe2eda235b520e7b3b78730d66a50e6c9cf1d..91e53c4df1039fde9c65a0bb6277bae2d0c7251e 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698