diff options
author | 2014-05-30 20:42:00 +0000 | |
---|---|---|
committer | 2014-05-30 20:42:00 +0000 | |
commit | 5a70945ddd036b8079987954123ff8f382c285af (patch) | |
tree | 3bb2d0ee55d6732edc13c04d4f63050deea157e3 /src/ports/SkFontConfigInterface_direct.cpp | |
parent | 2a5cd60bfff32c92cf44a8cfc3e8c017b9aee456 (diff) |
Port most uses of SkOnce to SkLazyPtr.
BUG=skia:
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/304383005
git-svn-id: http://skia.googlecode.com/svn/trunk@15006 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports/SkFontConfigInterface_direct.cpp')
-rw-r--r-- | src/ports/SkFontConfigInterface_direct.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/ports/SkFontConfigInterface_direct.cpp b/src/ports/SkFontConfigInterface_direct.cpp index 80ee56e85c..bc3dede40d 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(); } /////////////////////////////////////////////////////////////////////////////// |