diff options
author | reed <reed@google.com> | 2016-05-04 17:14:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 17:14:44 -0700 |
commit | 7eb33da7eede34c050b865dbb1b60c3dcea7191b (patch) | |
tree | d17a15c24a12d6c805ef04c938016c3e1a59f864 /src/core/SkPathRef.cpp | |
parent | 086eea93b1f8253420c233c33cdabc0e74b08091 (diff) |
Revert of SkOncePtr -> SkOnce (patchset #4 id:60001 of https://codereview.chromium.org/1953533002/ )
Reason for revert:
broken the Mac and Linux builders, e.g.:
https://build.chromium.org/p/chromium/builders/Mac/builds/15151
https://build.chromium.org/p/chromium/builders/Linux%20x64/builds/19052
Original issue's description:
> SkOncePtr -> SkOnce
>
> It's always nice to kill off a synchronization primitive.
> And while less terse, I think this new code reads more clearly.
>
> ... and, SkOncePtr's tests were the only thing now using sk_num_cores()
> outside of SkTaskGroup, so I've hidden it as static inside SkTaskGroup.cpp.
>
> BUG=skia:
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1953533002
> CQ_EXTRA_TRYBOTS=client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-SKNX_NO_SIMD-Trybot
>
> Committed: https://skia.googlesource.com/skia/+/9bd3fc7fa9bb7cad050bd619aa93d4c48ebb5c02
TBR=herb@google.com,mtklein@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review-Url: https://codereview.chromium.org/1945293004
Diffstat (limited to 'src/core/SkPathRef.cpp')
-rw-r--r-- | src/core/SkPathRef.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index 2fc2de935c..b18055136f 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 @@ SkPathRef::~SkPathRef() { 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 @@ uint32_t SkPathRef::genID() const { } void SkPathRef::addGenIDChangeListener(GenIDChangeListener* listener) { - if (nullptr == listener || this == gEmpty) { + if (nullptr == listener || this == (SkPathRef*)empty) { delete listener; return; } |