Index: src/core/SkPathRef.cpp |
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp |
index be7c66cc4bb8263fd2ed2b490ab20d708b0c6ba9..119711381f6f1028ed47136138770a023ee7c6c0 100644 |
--- a/src/core/SkPathRef.cpp |
+++ b/src/core/SkPathRef.cpp |
@@ -6,7 +6,7 @@ |
*/ |
#include "SkBuffer.h" |
-#include "SkLazyPtr.h" |
+#include "SkOncePtr.h" |
#include "SkPath.h" |
#include "SkPathRef.h" |
@@ -44,17 +44,13 @@ SkPathRef::~SkPathRef() { |
SkDEBUGCODE(fEditorsAttached = 0x7777777;) |
} |
-// As a template argument, this must have external linkage. |
-SkPathRef* sk_create_empty_pathref() { |
- SkPathRef* empty = new SkPathRef; |
- empty->computeBounds(); // Avoids races later to be the first to do this. |
- return empty; |
-} |
- |
-SK_DECLARE_STATIC_LAZY_PTR(SkPathRef, empty, sk_create_empty_pathref); |
- |
+SK_DECLARE_STATIC_ONCE_PTR(SkPathRef, empty); |
SkPathRef* SkPathRef::CreateEmpty() { |
- return SkRef(empty.get()); |
+ return SkRef(empty.get([]{ |
+ SkPathRef* pr = new SkPathRef; |
+ pr->computeBounds(); // Avoids races later to be the first to do this. |
+ return pr; |
+ })); |
} |
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, |
@@ -443,7 +439,7 @@ uint32_t SkPathRef::genID() const { |
} |
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) { |
- if (nullptr == listener || this == empty.get()) { |
+ if (nullptr == listener || this == (SkPathRef*)empty) { |
delete listener; |
return; |
} |