Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Unified Diff: src/core/SkFontMgr.cpp

Issue 1322933005: Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: name Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkData.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFontMgr.cpp
diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp
index 7c06690d2e297e0892cbeaf685e100c6e43fa974..3190825c0fd4ca9d0bcd7378c877b21649ca1104 100644
--- a/src/core/SkFontMgr.cpp
+++ b/src/core/SkFontMgr.cpp
@@ -7,7 +7,7 @@
#include "SkFontDescriptor.h"
#include "SkFontMgr.h"
-#include "SkLazyPtr.h"
+#include "SkOncePtr.h"
#include "SkStream.h"
#include "SkTypes.h"
@@ -158,14 +158,10 @@ SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[],
return this->onLegacyCreateTypeface(familyName, styleBits);
}
-// As a template argument this must have external linkage.
-SkFontMgr* sk_fontmgr_create_default() {
- SkFontMgr* fm = SkFontMgr::Factory();
- return fm ? fm : new SkEmptyFontMgr;
-}
-
-SK_DECLARE_STATIC_LAZY_PTR(SkFontMgr, singleton, sk_fontmgr_create_default);
-
+SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton);
SkFontMgr* SkFontMgr::RefDefault() {
- return SkRef(singleton.get());
+ return SkRef(singleton.get([]{
+ SkFontMgr* fm = SkFontMgr::Factory();
+ return fm ? fm : new SkEmptyFontMgr;
+ }));
}
« no previous file with comments | « src/core/SkData.cpp ('k') | src/core/SkGlyphCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698