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

Side by Side 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: Fix test. 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGlyphCache.h" 8 #include "SkGlyphCache.h"
9 #include "SkGlyphCache_Globals.h" 9 #include "SkGlyphCache_Globals.h"
10 #include "SkGraphics.h" 10 #include "SkGraphics.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 444
445 void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) { 445 void SkGlyphCache::DumpMemoryStatistics(SkTraceMemoryDump* dump) {
446 dump->dumpNumericValue(gGlyphCacheDumpName, "size", "bytes", SkGraphics::Get FontCacheUsed()); 446 dump->dumpNumericValue(gGlyphCacheDumpName, "size", "bytes", SkGraphics::Get FontCacheUsed());
447 dump->dumpNumericValue(gGlyphCacheDumpName, "budget_size", "bytes", 447 dump->dumpNumericValue(gGlyphCacheDumpName, "budget_size", "bytes",
448 SkGraphics::GetFontCacheLimit()); 448 SkGraphics::GetFontCacheLimit());
449 dump->dumpNumericValue(gGlyphCacheDumpName, "glyph_count", "objects", 449 dump->dumpNumericValue(gGlyphCacheDumpName, "glyph_count", "objects",
450 SkGraphics::GetFontCacheCountUsed()); 450 SkGraphics::GetFontCacheCountUsed());
451 dump->dumpNumericValue(gGlyphCacheDumpName, "budget_glyph_count", "objects", 451 dump->dumpNumericValue(gGlyphCacheDumpName, "budget_glyph_count", "objects",
452 SkGraphics::GetFontCacheCountLimit()); 452 SkGraphics::GetFontCacheCountLimit());
453 453
454 if (dump->isLightDump()) {
455 dump->setMemoryBacking(gGlyphCacheDumpName, "malloc", nullptr);
456 return;
457 }
458
454 int counter = 0; 459 int counter = 0;
455 SkGlyphCacheDumpContext context = { &counter, dump }; 460 SkGlyphCacheDumpContext context = { &counter, dump };
456 SkGlyphCache::VisitAll(sk_trace_dump_visitor, &context); 461 SkGlyphCache::VisitAll(sk_trace_dump_visitor, &context);
457 } 462 }
458 463
459 void SkGlyphCache::VisitAll(Visitor visitor, void* context) { 464 void SkGlyphCache::VisitAll(Visitor visitor, void* context) {
460 SkGlyphCache_Globals& globals = get_globals(); 465 SkGlyphCache_Globals& globals = get_globals();
461 AutoAcquire ac(globals.fLock); 466 AutoAcquire ac(globals.fLock);
462 SkGlyphCache* cache; 467 SkGlyphCache* cache;
463 468
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 } 643 }
639 644
640 void SkGraphics::PurgeFontCache() { 645 void SkGraphics::PurgeFontCache() {
641 get_globals().purgeAll(); 646 get_globals().purgeAll();
642 SkTypefaceCache::PurgeAll(); 647 SkTypefaceCache::PurgeAll();
643 } 648 }
644 649
645 // TODO(herb): clean up TLS apis. 650 // TODO(herb): clean up TLS apis.
646 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; } 651 size_t SkGraphics::GetTLSFontCacheLimit() { return 0; }
647 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { } 652 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698