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

Unified Diff: src/core/SkPathRef.cpp

Issue 1334523002: Revert of Port uses of SkLazyPtr to SkOncePtr. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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/SkMiniRecorder.cpp ('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 119711381f6f1028ed47136138770a023ee7c6c0..be7c66cc4bb8263fd2ed2b490ab20d708b0c6ba9 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -6,7 +6,7 @@
*/
#include "SkBuffer.h"
-#include "SkOncePtr.h"
+#include "SkLazyPtr.h"
#include "SkPath.h"
#include "SkPathRef.h"
@@ -44,13 +44,17 @@
SkDEBUGCODE(fEditorsAttached = 0x7777777;)
}
-SK_DECLARE_STATIC_ONCE_PTR(SkPathRef, empty);
+// 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);
+
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;
- }));
+ return SkRef(empty.get());
}
void SkPathRef::CreateTransformedCopy(SkAutoTUnref<SkPathRef>* dst,
@@ -439,7 +443,7 @@
}
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (nullptr == listener || this == (SkPathRef*)empty) {
+ if (nullptr == listener || this == empty.get()) {
delete listener;
return;
}
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkTypeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698