diff options
author | mtklein <mtklein@chromium.org> | 2016-05-05 16:05:56 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-05 16:05:56 -0700 |
commit | ffa4a9213b4e754adc210fa02a3c4b1ae8d3b6d0 (patch) | |
tree | e6f20243b4ed7c36e36302d914e255dfa6799217 /src/fonts | |
parent | 4017007b288087c07c596baa9fe8ecf485bca1c3 (diff) |
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
Review-Url: https://codereview.chromium.org/1953533002
Diffstat (limited to 'src/fonts')
-rw-r--r-- | src/fonts/SkRemotableFontMgr.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/fonts/SkRemotableFontMgr.cpp b/src/fonts/SkRemotableFontMgr.cpp index 41e3bc3235..aca8a0b193 100644 --- a/src/fonts/SkRemotableFontMgr.cpp +++ b/src/fonts/SkRemotableFontMgr.cpp @@ -5,7 +5,7 @@ * found in the LICENSE file. */ -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkRemotableFontMgr.h" SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity** data) @@ -15,7 +15,9 @@ SkRemotableFontIdentitySet::SkRemotableFontIdentitySet(int count, SkFontIdentity *data = fData; } -SK_DECLARE_STATIC_ONCE_PTR(SkRemotableFontIdentitySet, empty); SkRemotableFontIdentitySet* SkRemotableFontIdentitySet::NewEmpty() { - return SkRef(empty.get([]{ return new SkRemotableFontIdentitySet; })); + static SkOnce once; + static SkRemotableFontIdentitySet* empty; + once([]{ empty = new SkRemotableFontIdentitySet; }); + return SkRef(empty); } |