diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 23:59:12 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-30 23:59:12 +0000 |
commit | 56f7cca144c539ec01f00d6382fded362ff193a3 (patch) | |
tree | 320e51ca850b8c7bf5ef14e1c523d385674eca14 /src/ports/SkFontConfigInterface_direct.cpp | |
parent | 22a1d96ca368a2d1fba40a541006be64af487ccd (diff) |
Port most uses of SkOnce to SkLazyPtr.
BUG=skia:
Committed: http://code.google.com/p/skia/source/detail?r=15006
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@15014 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(); } /////////////////////////////////////////////////////////////////////////////// |