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

Unified Diff: src/fonts/SkRemotableFontMgr.cpp

Issue 306063004: Revert of Port most uses of SkOnce to SkLazyPtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 7 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/SkTypeface.cpp ('k') | src/lazy/SkDiscardableMemoryPool.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/core/SkTypeface.cpp ('k') | src/lazy/SkDiscardableMemoryPool.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698