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

Unified Diff: src/core/SkPathRef.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/SkMessageBus.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPathRef.cpp
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp
index de7a8f56ae07a8939f56a05b26f6b034a2ae5f5c..161eb804199ba2f7e96d03d4a926819bdaaf99f1 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -6,7 +6,7 @@
*/
#include "SkBuffer.h"
-#include "SkLazyPtr.h"
+#include "SkOnce.h"
#include "SkPath.h"
#include "SkPathRef.h"
@@ -28,16 +28,18 @@
}
//////////////////////////////////////////////////////////////////////////////
-
-SkPathRef* SkPathRef::CreateEmptyImpl() {
- SkPathRef* p = SkNEW(SkPathRef);
- p->computeBounds(); // Preemptively avoid a race to clear fBoundsIsDirty.
- return p;
+static SkPathRef* gEmptyPathRef = NULL;
+static void cleanup_gEmptyPathRef() { gEmptyPathRef->unref(); }
+
+void SkPathRef::CreateEmptyImpl(int) {
+ gEmptyPathRef = SkNEW(SkPathRef);
+ gEmptyPathRef->computeBounds(); // Preemptively avoid a race to clear fBoundsIsDirty.
}
SkPathRef* SkPathRef::CreateEmpty() {
- SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, CreateEmptyImpl);
- return SkRef(empty.get());
+ SK_DECLARE_STATIC_ONCE(once);
+ SkOnce(&once, SkPathRef::CreateEmptyImpl, 0, cleanup_gEmptyPathRef);
+ return SkRef(gEmptyPathRef);
}
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
« no previous file with comments | « src/core/SkMessageBus.h ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698