aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ports/SkFontConfigInterface_direct.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-06-02 08:44:27 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-02 08:44:27 -0700
commit78358bf624c7e7c09ffccf638c50870808d884d6 (patch)
tree71a7dfbae1429f457cd5c31eb4469925991cf245 /src/ports/SkFontConfigInterface_direct.cpp
parent309e86912445879651d52ebbedb67b4ff3f1516c (diff)
Port most uses of SkOnce to SkLazyPtr.
BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=15006 Committed: http://code.google.com/p/skia/source/detail?r=15014 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/304383005
Diffstat (limited to 'src/ports/SkFontConfigInterface_direct.cpp')
-rw-r--r--src/ports/SkFontConfigInterface_direct.cpp15
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();
}
///////////////////////////////////////////////////////////////////////////////