Index: src/core/SkPathRef.cpp |
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp |
index b18055136f54ce2cc1ed95ed7fb569c298ec0c4d..2fc2de935c149031342cdcdc538535bf50dcb49b 100644 |
--- a/src/core/SkPathRef.cpp |
+++ b/src/core/SkPathRef.cpp |
@@ -6,7 +6,7 @@ |
*/ |
#include "SkBuffer.h" |
-#include "SkOncePtr.h" |
+#include "SkOnce.h" |
#include "SkPath.h" |
#include "SkPathRef.h" |
#include <limits> |
@@ -45,13 +45,15 @@ |
SkDEBUGCODE(fEditorsAttached = 0x7777777;) |
} |
-SK_DECLARE_STATIC_ONCE_PTR(SkPathRef, empty); |
+static SkPathRef* gEmpty = nullptr; |
+ |
SkPathRef* SkPathRef::CreateEmpty() { |
- return SkRef(empty.get([]{ |
- SkPathRef* pr = new SkPathRef; |
- pr->computeBounds(); // Avoids races later to be the first to do this. |
- return pr; |
- })); |
+ static SkOnce once; |
+ once([]{ |
+ gEmpty = new SkPathRef; |
+ gEmpty->computeBounds(); // Avoids races later to be the first to do this. |
+ }); |
+ return SkRef(gEmpty); |
} |
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst, |
@@ -469,7 +471,7 @@ |
} |
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) { |
- if (nullptr == listener || this == (SkPathRef*)empty) { |
+ if (nullptr == listener || this == gEmpty) { |
delete listener; |
return; |
} |