Index: src/core/SkGlyphCache.cpp |
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp |
index 2ab721aab464c74676cde710a711156c125e5a2d..699801d2dbb3cb9ca16c87c1bd8f3f5351b92495 100755 |
--- a/src/core/SkGlyphCache.cpp |
+++ b/src/core/SkGlyphCache.cpp |
@@ -11,7 +11,7 @@ |
#include "SkGlyphCache_Globals.h" |
#include "SkDistanceFieldGen.h" |
#include "SkGraphics.h" |
-#include "SkLazyPtr.h" |
+#include "SkOnce.h" |
#include "SkPaint.h" |
#include "SkPath.h" |
#include "SkTemplates.h" |
@@ -21,18 +21,18 @@ |
//#define SPEW_PURGE_STATUS |
//#define RECORD_HASH_EFFICIENCY |
-namespace { |
- |
-SkGlyphCache_Globals* create_globals() { |
- return SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex)); |
-} |
- |
-} // namespace |
+static void create_globals(SkGlyphCache_Globals** globals) { |
+ *globals = SkNEW_ARGS(SkGlyphCache_Globals, (SkGlyphCache_Globals::kYes_UseMutex)); |
+} |
// Returns the shared globals |
static SkGlyphCache_Globals& getSharedGlobals() { |
- SK_DECLARE_STATIC_LAZY_PTR(SkGlyphCache_Globals, globals, create_globals); |
- return *globals.get(); |
+ // we leak this, so we don't incur any shutdown cost of the destructor |
+ static SkGlyphCache_Globals* gGlobals = NULL; |
+ SK_DECLARE_STATIC_ONCE(once); |
+ SkOnce(&once, create_globals, &gGlobals); |
+ SkASSERT(NULL != gGlobals); |
+ return *gGlobals; |
} |
// Returns the TLS globals (if set), or the shared globals |