diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkGlyphCache.cpp | 19 | ||||
-rw-r--r-- | src/core/SkGlyphCache.h | 1 |
2 files changed, 6 insertions, 14 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 9f0dfba427..c8664f4a82 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -556,10 +556,7 @@ void SkGlyphCache::AttachCache(SkGlyphCache* cache) { } size_t SkGlyphCache::GetCacheUsed() { - SkGlyphCache_Globals& globals = getGlobals(); - SkAutoMutexAcquire ac(globals.fMutex); - - return SkGlyphCache::ComputeMemoryUsed(globals.fHead); + return getGlobals().fTotalMemoryUsed; } bool SkGlyphCache::SetCacheUsed(size_t bytesUsed) { @@ -585,19 +582,15 @@ SkGlyphCache* SkGlyphCache::FindTail(SkGlyphCache* cache) { return cache; } -size_t SkGlyphCache::ComputeMemoryUsed(const SkGlyphCache* head) { - size_t size = 0; - +#ifdef SK_DEBUG +void SkGlyphCache_Globals::validate() const { + size_t computed = 0; + while (head != NULL) { - size += head->fMemoryUsed; + computed += head->fMemoryUsed; head = head->fNext; } - return size; -} -#ifdef SK_DEBUG -void SkGlyphCache_Globals::validate() const { - size_t computed = SkGlyphCache::ComputeMemoryUsed(fHead); if (fTotalMemoryUsed != computed) { printf("total %d, computed %d\n", (int)fTotalMemoryUsed, (int)computed); } diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h index 2895c54b06..e1ab63530c 100644 --- a/src/core/SkGlyphCache.h +++ b/src/core/SkGlyphCache.h @@ -276,7 +276,6 @@ private: static size_t InternalFreeCache(SkGlyphCache_Globals*, size_t bytesNeeded); inline static SkGlyphCache* FindTail(SkGlyphCache* head); - static size_t ComputeMemoryUsed(const SkGlyphCache* head); friend class SkGlyphCache_Globals; }; |