Index: src/fonts/SkRemotableFontMgr.cpp |
diff --git a/src/fonts/SkRemotableFontMgr.cpp b/src/fonts/SkRemotableFontMgr.cpp |
index 633e91458bbb34d5c65fb3d64dc3ac5f877ebd5d..1139972848be68854deedef3b4d96858cbfba42d 100644 |
--- a/src/fonts/SkRemotableFontMgr.cpp |
+++ b/src/fonts/SkRemotableFontMgr.cpp |
@@ -7,7 +7,7 @@ |
#include "SkRemotableFontMgr.h" |
-#include "SkLazyPtr.h" |
+#include "SkOnce.h" |
SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity** data) |
: fCount(count), fData(count) |
@@ -16,11 +16,17 @@ |
*data = fData; |
} |
-SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmptyImpl() { |
- return SkNEW(SkRemotableFontIdentitySet); |
+static SkRemotableFontIdentitySet* gEmptyRemotableFontIdentitySet = NULL; |
+static void cleanup_gEmptyRemotableFontIdentitySet() { gEmptyRemotableFontIdentitySet->unref(); } |
+ |
+void SkRemotableFontIdentitySet::NewEmptyImpl(int) { |
+ gEmptyRemotableFontIdentitySet = new SkRemotableFontIdentitySet(); |
} |
SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() { |
- SK_DECLARE_STATIC_LAZY_PTR(SkRemotableFontIdentitySet, empty, NewEmptyImpl); |
- return SkRef(empty.get()); |
+ SK_DECLARE_STATIC_ONCE(once); |
+ SkOnce(&once, SkRemotableFontIdentitySet::NewEmptyImpl, 0, |
+ cleanup_gEmptyRemotableFontIdentitySet); |
+ gEmptyRemotableFontIdentitySet->ref(); |
+ return gEmptyRemotableFontIdentitySet; |
} |