Index: src/ports/SkFontConfigInterface_direct.cpp |
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp |
index 80ee56e85c6dbffa921d697e9c8709809a45a95f..bc3dede40d24c86748eb22cdef5bb649b39a66d3 100644 |
--- a/src/ports/SkFontConfigInterface_direct.cpp |
+++ b/src/ports/SkFontConfigInterface_direct.cpp |
@@ -15,7 +15,7 @@ |
#include "SkBuffer.h" |
#include "SkFontConfigInterface.h" |
-#include "SkOnce.h" |
+#include "SkLazyPtr.h" |
#include "SkStream.h" |
size_t SkFontConfigInterface::FontIdentity::writeToMemory(void* addr) const { |
@@ -124,14 +124,13 @@ private: |
SkMutex mutex_; |
}; |
-static void create_singleton_direct_interface(SkFontConfigInterface** singleton) { |
- *singleton = new SkFontConfigInterfaceDirect; |
-} |
+namespace { |
+SkFontConfigInterface* create_direct() { return SkNEW(SkFontConfigInterfaceDirect); } |
+} // namespace |
+ |
SkFontConfigInterface* SkFontConfigInterface::GetSingletonDirectInterface() { |
- static SkFontConfigInterface* gDirect; |
- SK_DECLARE_STATIC_ONCE(once); |
- SkOnce(&once, create_singleton_direct_interface, &gDirect); |
- return gDirect; |
+ SK_DECLARE_STATIC_LAZY_PTR(SkFontConfigInterface, direct, create_direct); |
+ return direct.get(); |
} |
/////////////////////////////////////////////////////////////////////////////// |