diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-11-17 22:09:47 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2011-11-17 22:09:47 +0000 |
commit | 9998c669300281b5682fce72b036c1a6a619a44e (patch) | |
tree | 71be8d0aa56a22df2ddabb694402a21682730105 /src/core | |
parent | 5d248bce640b7f0a32afdc8b8ca571f3673c792b (diff) |
remove all references to SkGlobals (obsolete)
git-svn-id: http://skia.googlecode.com/svn/trunk@2713 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkGlobals.cpp | 84 | ||||
-rw-r--r-- | src/core/SkGlyphCache.cpp | 8 | ||||
-rw-r--r-- | src/core/SkGraphics.cpp | 4 |
3 files changed, 8 insertions, 88 deletions
diff --git a/src/core/SkGlobals.cpp b/src/core/SkGlobals.cpp deleted file mode 100644 index e385734bb5..0000000000 --- a/src/core/SkGlobals.cpp +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#include "SkGlobals.h" -#include "SkThread.h" - -SkGlobals::Rec::~Rec() -{ -} - -SkGlobals::Rec* SkGlobals::Find(uint32_t tag, Rec* (*create_proc)()) -{ - SkGlobals::BootStrap& bootstrap = SkGlobals::GetBootStrap(); - - Rec* rec = bootstrap.fHead; - while (rec) - { - if (rec->fTag == tag) - return rec; - rec = rec->fNext; - } - - if (create_proc == NULL) // no create proc, just return not found - return NULL; - - // if we get here, we may need to create one. First grab the mutex, and - // search again, creating one if its not found the 2nd time. - - bootstrap.fMutex.acquire(); - - // search again, now that we have the mutex. Odds are it won't be there, but we check again - // just in case it was added by another thread before we grabbed the mutex - - Rec*& head = bootstrap.fHead; - rec = head; - while (rec) - { - if (rec->fTag == tag) - break; - rec = rec->fNext; - } - - if (rec == NULL && (rec = create_proc()) != NULL) - { - rec->fTag = tag; - rec->fNext = head; - bootstrap.fHead = rec; - } - - bootstrap.fMutex.release(); - return rec; -} - -void SkGlobals::Init() -{ -} - -void SkGlobals::Term() -{ - SkGlobals::BootStrap& bootstrap = SkGlobals::GetBootStrap(); - - bootstrap.fMutex.acquire(); - - Rec*& head = bootstrap.fHead; - Rec* rec = head; - - while (rec) - { - Rec* next = rec->fNext; - SkDELETE(rec); - rec = next; - } - - bootstrap.fHead = NULL; - bootstrap.fMutex.release(); -} - - diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index e2bed06a6a..c3725a6d55 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -410,6 +410,14 @@ void SkGlyphCache::invokeAndRemoveAuxProcs() { class SkGlyphCache_Globals { public: + SkGlyphCache_Globals() { + fHead = NULL; + fTotalMemoryUsed = 0; +#ifdef USE_CACHE_HASH + sk_bzero(fHash, sizeof(fHash)); +#endif + } + SkMutex fMutex; SkGlyphCache* fHead; size_t fTotalMemoryUsed; diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 542a1997ab..a69ac370fd 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -14,7 +14,6 @@ #include "SkCanvas.h" #include "SkFloat.h" #include "SkGeometry.h" -#include "SkGlobals.h" #include "SkMath.h" #include "SkMatrix.h" #include "SkPath.h" @@ -52,8 +51,6 @@ void SkGraphics::GetVersion(int32_t* major, int32_t* minor, int32_t* patch) { #endif void SkGraphics::Init() { - SkGlobals::Init(); - #ifdef BUILD_EMBOSS_TABLE SkEmbossMask_BuildTable(); #endif @@ -127,7 +124,6 @@ void SkGraphics::Init() { void SkGraphics::Term() { SkGlyphCache::SetCacheUsed(0); SkTypefaceCache::PurgeAll(); - SkGlobals::Term(); } #ifndef SK_DEFAULT_FONT_CACHE_LIMIT |