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, |