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

Unified Diff: src/fonts/SkRemotableFontMgr.cpp

Issue 304383005: Port most uses of SkOnce to SkLazyPtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add mutex 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 1139972848be68854deedef3b4d96858cbfba42d..633e91458bbb34d5c65fb3d64dc3ac5f877ebd5d 100644
--- a/src/fonts/SkRemotableFontMgr.cpp
+++ b/src/fonts/SkRemotableFontMgr.cpp
@@ -7,7 +7,7 @@
#include "SkRemotableFontMgr.h"
-#include "SkOnce.h"
+#include "SkLazyPtr.h"
SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity** data)
: fCount(count), fData(count)
@@ -16,17 +16,11 @@ SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity
*data = fData;
}
-static SkRemotableFontIdentitySet* gEmptyRemotableFontIdentitySet = NULL;
-static void cleanup_gEmptyRemotableFontIdentitySet() { gEmptyRemotableFontIdentitySet->unref(); }
-
-void SkRemotableFontIdentitySet::NewEmptyImpl(int) {
- gEmptyRemotableFontIdentitySet = new SkRemotableFontIdentitySet();
+SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmptyImpl() {
+ return SkNEW(SkRemotableFontIdentitySet);
}
SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() {
- SK_DECLARE_STATIC_ONCE(once);
- SkOnce(&once, SkRemotableFontIdentitySet::NewEmptyImpl, 0,
- cleanup_gEmptyRemotableFontIdentitySet);
- gEmptyRemotableFontIdentitySet->ref();
- return gEmptyRemotableFontIdentitySet;
+ SK_DECLARE_STATIC_LAZY_PTR(SkRemotableFontIdentitySet, empty, NewEmptyImpl);
+ return SkRef(empty.get());
}
« 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