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

Unified Diff: src/core/SkPathRef.cpp

Issue 1945293004: Revert of SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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/SkMiniRecorder.cpp ('k') | src/core/SkTaskGroup.h » ('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 2fc2de935c149031342cdcdc538535bf50dcb49b..b18055136f54ce2cc1ed95ed7fb569c298ec0c4d 100644
--- a/src/core/SkPathRef.cpp
+++ b/src/core/SkPathRef.cpp
@@ -6,7 +6,7 @@
*/
#include "SkBuffer.h"
-#include "SkOnce.h"
+#include "SkOncePtr.h"
#include "SkPath.h"
#include "SkPathRef.h"
#include <limits>
@@ -45,15 +45,13 @@
SkDEBUGCODE(fEditorsAttached = 0x7777777;)
}
-static SkPathRef* gEmpty = nullptr;
-
+SK_DECLARE_STATIC_ONCE_PTR(SkPathRef, empty);
SkPathRef* SkPathRef::CreateEmpty() {
- static SkOnce once;
- once([]{
- gEmpty = new SkPathRef;
- gEmpty->computeBounds(); // Avoids races later to be the first to do this.
- });
- return SkRef(gEmpty);
+ 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,
@@ -471,7 +469,7 @@
}
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (nullptr == listener || this == gEmpty) {
+ if (nullptr == listener || this == (SkPathRef*)empty) {
delete listener;
return;
}
« no previous file with comments | « src/core/SkMiniRecorder.cpp ('k') | src/core/SkTaskGroup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698