From eb9a9bfc73d7fa03e2dab16dd4734290a738e9e7 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Mon, 23 Apr 2012 13:43:30 +0000 Subject: cleanups in prep for tls cache Review URL: https://codereview.appspot.com/6109045 git-svn-id: http://skia.googlecode.com/svn/trunk@3749 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkGlyphCache.cpp | 19 ++++++------------- src/core/SkGlyphCache.h | 1 - 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'src/core') 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; }; -- cgit v1.2.3