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
This commit is contained in:
reed@google.com 2012-04-23 13:43:30 +00:00
parent e6f7d6821f
commit eb9a9bfc73
3 changed files with 9 additions and 17 deletions

View File

@ -12,7 +12,7 @@
#include "SkTypes.h"
class SkGraphics {
class SK_API SkGraphics {
public:
/**
* Call this at process initialization time if your environment does not

View File

@ -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;
while (head != NULL) {
size += head->fMemoryUsed;
head = head->fNext;
}
return size;
}
#ifdef SK_DEBUG
void SkGlyphCache_Globals::validate() const {
size_t computed = SkGlyphCache::ComputeMemoryUsed(fHead);
size_t computed = 0;
while (head != NULL) {
computed += head->fMemoryUsed;
head = head->fNext;
}
if (fTotalMemoryUsed != computed) {
printf("total %d, computed %d\n", (int)fTotalMemoryUsed, (int)computed);
}

View File

@ -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;
};