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

Side by Side Diff: src/core/SkGlyphCache.cpp

Issue 264333008: Clean up global gSkSuppressFontCachePurgeSpew. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « gm/gmmain.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkGlyphCache.h" 10 #include "SkGlyphCache.h"
11 #include "SkGlyphCache_Globals.h" 11 #include "SkGlyphCache_Globals.h"
12 #include "SkDistanceFieldGen.h" 12 #include "SkDistanceFieldGen.h"
13 #include "SkGraphics.h" 13 #include "SkGraphics.h"
14 #include "SkOnce.h" 14 #include "SkOnce.h"
15 #include "SkPaint.h" 15 #include "SkPaint.h"
16 #include "SkPath.h" 16 #include "SkPath.h"
17 #include "SkTemplates.h" 17 #include "SkTemplates.h"
18 #include "SkTLS.h" 18 #include "SkTLS.h"
19 #include "SkTypeface.h" 19 #include "SkTypeface.h"
20 20
21 //#define SPEW_PURGE_STATUS 21 //#define SPEW_PURGE_STATUS
22 //#define RECORD_HASH_EFFICIENCY 22 //#define RECORD_HASH_EFFICIENCY
23 23
24 bool gSkSuppressFontCachePurgeSpew;
25
26 static void create_globals(SkGlyphCache_Globals** globals) { 24 static void create_globals(SkGlyphCache_Globals** globals) {
27 *globals = SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseM utex)); 25 *globals = SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseM utex));
28 } 26 }
29 27
30 // Returns the shared globals 28 // Returns the shared globals
31 static SkGlyphCache_Globals& getSharedGlobals() { 29 static SkGlyphCache_Globals& getSharedGlobals() {
32 // we leak this, so we don't incur any shutdown cost of the destructor 30 // we leak this, so we don't incur any shutdown cost of the destructor
33 static SkGlyphCache_Globals* gGlobals = NULL; 31 static SkGlyphCache_Globals* gGlobals = NULL;
34 SK_DECLARE_STATIC_ONCE(once); 32 SK_DECLARE_STATIC_ONCE(once);
35 SkOnce(&once, create_globals, &gGlobals); 33 SkOnce(&once, create_globals, &gGlobals);
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 countFreed += 1; 636 countFreed += 1;
639 637
640 this->internalDetachCache(cache); 638 this->internalDetachCache(cache);
641 SkDELETE(cache); 639 SkDELETE(cache);
642 cache = prev; 640 cache = prev;
643 } 641 }
644 642
645 this->validate(); 643 this->validate();
646 644
647 #ifdef SPEW_PURGE_STATUS 645 #ifdef SPEW_PURGE_STATUS
648 if (countFreed && !gSkSuppressFontCachePurgeSpew) { 646 if (countFreed) {
649 SkDebugf("purging %dK from font cache [%d entries]\n", 647 SkDebugf("purging %dK from font cache [%d entries]\n",
650 (int)(bytesFreed >> 10), countFreed); 648 (int)(bytesFreed >> 10), countFreed);
651 } 649 }
652 #endif 650 #endif
653 651
654 return bytesFreed; 652 return bytesFreed;
655 } 653 }
656 654
657 void SkGlyphCache_Globals::internalAttachCacheToHead(SkGlyphCache* cache) { 655 void SkGlyphCache_Globals::internalAttachCacheToHead(SkGlyphCache* cache) {
658 SkASSERT(NULL == cache->fPrev && NULL == cache->fNext); 656 SkASSERT(NULL == cache->fPrev && NULL == cache->fNext);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 return tls ? tls->getCacheSizeLimit() : 0; 757 return tls ? tls->getCacheSizeLimit() : 0;
760 } 758 }
761 759
762 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) { 760 void SkGraphics::SetTLSFontCacheLimit(size_t bytes) {
763 if (0 == bytes) { 761 if (0 == bytes) {
764 SkGlyphCache_Globals::DeleteTLS(); 762 SkGlyphCache_Globals::DeleteTLS();
765 } else { 763 } else {
766 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes); 764 SkGlyphCache_Globals::GetTLS().setCacheSizeLimit(bytes);
767 } 765 }
768 } 766 }
OLDNEW
« no previous file with comments | « gm/gmmain.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698