| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 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 #ifndef SkGlyphCache_Globals_DEFINED | 8 #ifndef SkGlyphCache_Globals_DEFINED |
| 9 #define SkGlyphCache_Globals_DEFINED | 9 #define SkGlyphCache_Globals_DEFINED |
| 10 | 10 |
| 11 #include "SkGlyphCache.h" | 11 #include "SkGlyphCache.h" |
| 12 #include "SkMutex.h" | 12 #include "SkMutex.h" |
| 13 #include "SkSpinlock.h" | 13 #include "SkSpinlock.h" |
| 14 #include "SkTLS.h" | 14 #include "SkTLS.h" |
| 15 | 15 |
| 16 #ifndef SK_DEFAULT_FONT_CACHE_COUNT_LIMIT | 16 #ifndef SK_DEFAULT_FONT_CACHE_COUNT_LIMIT |
| 17 #define SK_DEFAULT_FONT_CACHE_COUNT_LIMIT 2048 | 17 #define SK_DEFAULT_FONT_CACHE_COUNT_LIMIT 2048 |
| 18 #endif | 18 #endif |
| 19 | 19 |
| 20 #ifndef SK_DEFAULT_FONT_CACHE_LIMIT | 20 #ifndef SK_DEFAULT_FONT_CACHE_LIMIT |
| 21 #define SK_DEFAULT_FONT_CACHE_LIMIT (2 * 1024 * 1024) | 21 #define SK_DEFAULT_FONT_CACHE_LIMIT (2 * 1024 * 1024) |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
| 25 | 25 |
| 26 class SkGlyphCache_Globals { | 26 class SkGlyphCache_Globals { |
| 27 public: | 27 public: |
| 28 SkGlyphCache_Globals() { | 28 SkGlyphCache_Globals() { |
| 29 fHead = NULL; | 29 fHead = nullptr; |
| 30 fTotalMemoryUsed = 0; | 30 fTotalMemoryUsed = 0; |
| 31 fCacheSizeLimit = SK_DEFAULT_FONT_CACHE_LIMIT; | 31 fCacheSizeLimit = SK_DEFAULT_FONT_CACHE_LIMIT; |
| 32 fCacheCount = 0; | 32 fCacheCount = 0; |
| 33 fCacheCountLimit = SK_DEFAULT_FONT_CACHE_COUNT_LIMIT; | 33 fCacheCountLimit = SK_DEFAULT_FONT_CACHE_COUNT_LIMIT; |
| 34 } | 34 } |
| 35 | 35 |
| 36 ~SkGlyphCache_Globals() { | 36 ~SkGlyphCache_Globals() { |
| 37 SkGlyphCache* cache = fHead; | 37 SkGlyphCache* cache = fHead; |
| 38 while (cache) { | 38 while (cache) { |
| 39 SkGlyphCache* next = cache->fNext; | 39 SkGlyphCache* next = cache->fNext; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int32_t fCacheCountLimit; | 85 int32_t fCacheCountLimit; |
| 86 int32_t fCacheCount; | 86 int32_t fCacheCount; |
| 87 | 87 |
| 88 // Checkout budgets, modulated by the specified min-bytes-needed-to-purge, | 88 // Checkout budgets, modulated by the specified min-bytes-needed-to-purge, |
| 89 // and attempt to purge caches to match. | 89 // and attempt to purge caches to match. |
| 90 // Returns number of bytes freed. | 90 // Returns number of bytes freed. |
| 91 size_t internalPurge(size_t minBytesNeeded = 0); | 91 size_t internalPurge(size_t minBytesNeeded = 0); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 #endif | 94 #endif |
| OLD | NEW |