diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-04-23 13:43:30 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-04-23 13:43:30 +0000 |
commit | eb9a9bfc73d7fa03e2dab16dd4734290a738e9e7 (patch) | |
tree | 92ba11d75873a133c8f6da40005664d4513b8d37 /src/core | |
parent | e6f7d6821fa3cd836e0af6596d8a15e961ebd2e3 (diff) |
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
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; }; |