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

Unified Diff: src/core/SkPathRef.cpp

Issue 1953533002: SkOncePtr -> SkOnce (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: hide sk_num_cores() 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 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 @@ SkPathRef::~SkPathRef() {
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 @@ uint32_t SkPathRef::genID() const {
}
void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) {
- if (nullptr == listener || this == (SkPathRef*)empty) {
+ if (nullptr == listener || this == gEmpty) {
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