diff options
author | mtklein <mtklein@chromium.org> | 2016-05-04 14:40:18 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-04 14:40:18 -0700 |
commit | 9bd3fc7fa9bb7cad050bd619aa93d4c48ebb5c02 (patch) | |
tree | 34a4f19d22263c547d2a53734caf179797fb9b53 /src | |
parent | f2509381bdd9e712919418f7ebe831f974208154 (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
Review-Url: https://codereview.chromium.org/1953533002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkColorSpace.cpp | 18 | ||||
-rw-r--r-- | src/core/SkData.cpp | 10 | ||||
-rw-r--r-- | src/core/SkFontMgr.cpp | 13 | ||||
-rw-r--r-- | src/core/SkGlyphCache.cpp | 9 | ||||
-rw-r--r-- | src/core/SkImageFilterCache.cpp | 9 | ||||
-rw-r--r-- | src/core/SkMessageBus.h | 8 | ||||
-rw-r--r-- | src/core/SkMiniRecorder.cpp | 10 | ||||
-rw-r--r-- | src/core/SkPathRef.cpp | 18 | ||||
-rw-r--r-- | src/core/SkTaskGroup.cpp | 22 | ||||
-rw-r--r-- | src/core/SkTaskGroup.h | 3 | ||||
-rw-r--r-- | src/core/SkTypeface.cpp | 12 | ||||
-rw-r--r-- | src/core/SkXfermode.cpp | 21 | ||||
-rw-r--r-- | src/fonts/SkRemotableFontMgr.cpp | 8 | ||||
-rw-r--r-- | src/lazy/SkDiscardableMemoryPool.cpp | 12 | ||||
-rw-r--r-- | src/opts/opts_check_x86.cpp | 1 | ||||
-rw-r--r-- | src/ports/SkFontHost_mac.cpp | 8 | ||||
-rw-r--r-- | src/utils/SkEventTracer.cpp | 10 |
17 files changed, 110 insertions, 82 deletions
diff --git a/src/core/SkColorSpace.cpp b/src/core/SkColorSpace.cpp index 55ab4c177a..889746f41b 100644 --- a/src/core/SkColorSpace.cpp +++ b/src/core/SkColorSpace.cpp @@ -7,7 +7,7 @@ #include "SkAtomics.h" #include "SkColorSpace.h" -#include "SkOncePtr.h" +#include "SkOnce.h" static bool color_space_almost_equal(float a, float b) { return SkTAbs(a - b) < 0.01f; @@ -43,8 +43,6 @@ const float gSRGB_toXYZD50[] { 0.1430f, 0.0606f, 0.7139f, // * B }; -SK_DECLARE_STATIC_ONCE_PTR(SkColorSpace, sRGB); - sk_sp<SkColorSpace> SkColorSpace::NewRGB(SkGammas gammas, const SkMatrix44& toXYZD50) { // Check if we really have sRGB if (color_space_almost_equal(2.2f, gammas.fRed.fValue) && @@ -74,13 +72,17 @@ sk_sp<SkColorSpace> SkColorSpace::NewRGB(SkGammas gammas, const SkMatrix44& toXY } sk_sp<SkColorSpace> SkColorSpace::NewNamed(Named named) { + static SkOnce once; + static SkColorSpace* sRGB; + switch (named) { case kSRGB_Named: { - SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); - srgbToxyzD50.set3x3ColMajorf(gSRGB_toXYZD50); - return sk_ref_sp(sRGB.get([=]{ - return new SkColorSpace(SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50, kSRGB_Named); - })); + once([] { + SkMatrix44 srgbToxyzD50(SkMatrix44::kUninitialized_Constructor); + srgbToxyzD50.set3x3ColMajorf(gSRGB_toXYZD50); + sRGB = new SkColorSpace(SkGammas(2.2f, 2.2f, 2.2f), srgbToxyzD50, kSRGB_Named); + }); + return sk_ref_sp(sRGB); } default: break; diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp index 995a30a542..ea2da3dae4 100644 --- a/src/core/SkData.cpp +++ b/src/core/SkData.cpp @@ -7,7 +7,7 @@ #include "SkData.h" #include "SkOSFile.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkReadBuffer.h" #include "SkStream.h" #include "SkWriteBuffer.h" @@ -80,10 +80,12 @@ sk_sp<SkData> SkData::PrivateNewWithCopy(const void* srcOrNull, size_t length) { /////////////////////////////////////////////////////////////////////////////// -SK_DECLARE_STATIC_ONCE_PTR(SkData, gEmpty); sk_sp<SkData> SkData::MakeEmpty() { - SkData* data = SkRef(gEmpty.get([]{return new SkData(nullptr, 0, nullptr, nullptr); })); - return sk_sp<SkData>(data); + static SkOnce once; + static SkData* empty; + + once([]{ empty = new SkData(nullptr, 0, nullptr, nullptr); }); + return sk_ref_sp(empty); } // assumes fPtr was allocated via sk_malloc diff --git a/src/core/SkFontMgr.cpp b/src/core/SkFontMgr.cpp index ebb9a89662..0f00667926 100644 --- a/src/core/SkFontMgr.cpp +++ b/src/core/SkFontMgr.cpp @@ -7,7 +7,7 @@ #include "SkFontDescriptor.h" #include "SkFontMgr.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkStream.h" #include "SkTypes.h" @@ -169,12 +169,15 @@ SkTypeface* SkFontMgr::legacyCreateTypeface(const char familyName[], SkFontStyle return this->onLegacyCreateTypeface(familyName, style); } -SK_DECLARE_STATIC_ONCE_PTR(SkFontMgr, singleton); SkFontMgr* SkFontMgr::RefDefault() { - return SkRef(singleton.get([]{ + static SkOnce once; + static SkFontMgr* singleton; + + once([]{ SkFontMgr* fm = SkFontMgr::Factory(); - return fm ? fm : new SkEmptyFontMgr; - })); + singleton = fm ? fm : new SkEmptyFontMgr; + }); + return SkRef(singleton); } /** diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index 309f494828..7256de6cdc 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -8,7 +8,7 @@ #include "SkGlyphCache.h" #include "SkGlyphCache_Globals.h" #include "SkGraphics.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkPath.h" #include "SkTemplates.h" #include "SkTraceMemoryDump.h" @@ -23,9 +23,12 @@ const char gGlyphCacheDumpName[] = "skia/sk_glyph_cache"; } // namespace // Returns the shared globals -SK_DECLARE_STATIC_ONCE_PTR(SkGlyphCache_Globals, globals); static SkGlyphCache_Globals& get_globals() { - return *globals.get([]{ return new SkGlyphCache_Globals; }); + static SkOnce once; + static SkGlyphCache_Globals* globals; + + once([]{ globals = new SkGlyphCache_Globals; }); + return *globals; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/core/SkImageFilterCache.cpp b/src/core/SkImageFilterCache.cpp index d87cf6b7c3..ba8a32c889 100644 --- a/src/core/SkImageFilterCache.cpp +++ b/src/core/SkImageFilterCache.cpp @@ -9,7 +9,7 @@ #include "SkChecksum.h" #include "SkMutex.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkRefCnt.h" #include "SkSpecialImage.h" #include "SkTDynamicHash.h" @@ -125,7 +125,10 @@ SkImageFilterCache* SkImageFilterCache::Create(size_t maxBytes) { return new CacheImpl(maxBytes); } -SK_DECLARE_STATIC_ONCE_PTR(SkImageFilterCache, cache); SkImageFilterCache* SkImageFilterCache::Get() { - return cache.get([]{ return SkImageFilterCache::Create(kDefaultCacheSize); }); + static SkOnce once; + static SkImageFilterCache* cache; + + once([]{ cache = SkImageFilterCache::Create(kDefaultCacheSize); }); + return cache; } diff --git a/src/core/SkMessageBus.h b/src/core/SkMessageBus.h index a2802f06d4..79f5c026dc 100644 --- a/src/core/SkMessageBus.h +++ b/src/core/SkMessageBus.h @@ -9,7 +9,7 @@ #define SkMessageBus_DEFINED #include "SkMutex.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkTArray.h" #include "SkTDArray.h" #include "SkTypes.h" @@ -47,10 +47,12 @@ private: // This must go in a single .cpp file, not some .h, or we risk creating more than one global // SkMessageBus per type when using shared libraries. NOTE: at most one per file will compile. #define DECLARE_SKMESSAGEBUS_MESSAGE(Message) \ - SK_DECLARE_STATIC_ONCE_PTR(SkMessageBus<Message>, bus); \ template <> \ SkMessageBus<Message>* SkMessageBus<Message>::Get() { \ - return bus.get([]{ return new SkMessageBus<Message>(); }); \ + static SkOnce once; \ + static SkMessageBus<Message>* bus; \ + once([] { bus = new SkMessageBus<Message>(); }); \ + return bus; \ } // ----------------------- Implementation of SkMessageBus::Inbox ----------------------- diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp index 2d5b0943e5..378f4304b3 100644 --- a/src/core/SkMiniRecorder.cpp +++ b/src/core/SkMiniRecorder.cpp @@ -8,7 +8,7 @@ #include "SkCanvas.h" #include "SkTLazy.h" #include "SkMiniRecorder.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkPicture.h" #include "SkPictureCommon.h" #include "SkRecordDraw.h" @@ -27,7 +27,6 @@ public: int numSlowPaths() const override { return 0; } bool willPlayBackBitmaps() const override { return false; } }; -SK_DECLARE_STATIC_ONCE_PTR(SkEmptyPicture, gEmptyPicture); template <typename T> class SkMiniPicture final : public SkPicture { @@ -107,8 +106,13 @@ sk_sp<SkPicture> SkMiniRecorder::detachAsPicture(const SkRect& cull) { fState = State::kEmpty; \ return sk_make_sp<SkMiniPicture<Type>>(cull, reinterpret_cast<Type*>(fBuffer.get())) + static SkOnce once; + static SkPicture* empty; + switch (fState) { - case State::kEmpty: return sk_ref_sp(gEmptyPicture.get([]{ return new SkEmptyPicture; })); + case State::kEmpty: + once([]{ empty = new SkEmptyPicture; }); + return sk_ref_sp(empty); CASE(DrawBitmapRectFixedSize); CASE(DrawPath); CASE(DrawRect); diff --git a/src/core/SkPathRef.cpp b/src/core/SkPathRef.cpp index b18055136f..2fc2de935c 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; } diff --git a/src/core/SkTaskGroup.cpp b/src/core/SkTaskGroup.cpp index 2ae1b59971..7a58c865a7 100644 --- a/src/core/SkTaskGroup.cpp +++ b/src/core/SkTaskGroup.cpp @@ -14,25 +14,25 @@ #include "SkThreadUtils.h" #if defined(SK_BUILD_FOR_WIN32) - static void query_num_cores(int* num_cores) { + static void query_num_cores(int* cores) { SYSTEM_INFO sysinfo; GetNativeSystemInfo(&sysinfo); - *num_cores = sysinfo.dwNumberOfProcessors; + *cores = sysinfo.dwNumberOfProcessors; } #else #include <unistd.h> - static void query_num_cores(int* num_cores) { - *num_cores = (int)sysconf(_SC_NPROCESSORS_ONLN); + static void query_num_cores(int* cores) { + *cores = (int)sysconf(_SC_NPROCESSORS_ONLN); } #endif -int sk_num_cores() { - // We cache sk_num_cores() so we only query the OS once. - static int num_cores = 0; +static int num_cores() { + // We cache num_cores() so we only query the OS once. + static int cores = 0; static SkOnce once; - once(query_num_cores, &num_cores); - SkASSERT(num_cores > 0); - return num_cores; + once(query_num_cores, &cores); + SkASSERT(cores > 0); + return cores; } namespace { @@ -98,7 +98,7 @@ private: explicit ThreadPool(int threads) { if (threads == -1) { - threads = sk_num_cores(); + threads = num_cores(); } for (int i = 0; i < threads; i++) { fThreads.push(new SkThread(&ThreadPool::Loop, this)); diff --git a/src/core/SkTaskGroup.h b/src/core/SkTaskGroup.h index 0d86cdb829..0f793f31e2 100644 --- a/src/core/SkTaskGroup.h +++ b/src/core/SkTaskGroup.h @@ -39,7 +39,4 @@ private: SkAtomic<int32_t> fPending; }; -// Returns best estimate of number of CPU cores available to use. -int sk_num_cores(); - #endif//SkTaskGroup_DEFINED diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 3830c46c7a..75bb05c2b1 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -11,7 +11,7 @@ #include "SkFontMgr.h" #include "SkMutex.h" #include "SkOTTable_OS_2.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkStream.h" #include "SkTypeface.h" @@ -79,21 +79,23 @@ protected: } SK_DECLARE_STATIC_MUTEX(gCreateDefaultMutex); -SK_DECLARE_STATIC_ONCE_PTR(SkTypeface, defaults[4]); SkTypeface* SkTypeface::GetDefaultTypeface(Style style) { + static SkOnce once[4]; + static SkTypeface* defaults[4]; + SkASSERT((int)style < 4); - return defaults[style].get([=]{ + once[style]([style] { // It is not safe to call FontConfigTypeface::LegacyCreateTypeface concurrently. // To be safe, we serialize here with a mutex so only one call to // CreateTypeface is happening at any given time. // TODO(bungeman, mtklein): This is sad. Make our fontconfig code safe? SkAutoMutexAcquire lock(&gCreateDefaultMutex); - SkAutoTUnref<SkFontMgr> fm(SkFontMgr::RefDefault()); SkTypeface* t = fm->legacyCreateTypeface(nullptr, SkFontStyle::FromOldStyle(style)); - return t ? t : SkEmptyTypeface::Create(); + defaults[style] = t ? t : SkEmptyTypeface::Create(); }); + return defaults[style]; } SkTypeface* SkTypeface::RefDefault(Style style) { diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp index 1cfe864751..b6d23888a7 100644 --- a/src/core/SkXfermode.cpp +++ b/src/core/SkXfermode.cpp @@ -9,7 +9,7 @@ #include "SkXfermode_proccoeff.h" #include "SkColorPriv.h" #include "SkMathPriv.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkOpts.h" #include "SkReadBuffer.h" #include "SkString.h" @@ -1303,11 +1303,7 @@ void SkProcCoeffXfermode::toString(SkString* str) const { #endif -SK_DECLARE_STATIC_ONCE_PTR(SkXfermode, cached[SkXfermode::kLastMode + 1]); - sk_sp<SkXfermode> SkXfermode::Make(Mode mode) { - SkASSERT(SK_ARRAY_COUNT(gProcCoeffs) == kModeCount); - if ((unsigned)mode >= kModeCount) { // report error return nullptr; @@ -1319,13 +1315,20 @@ sk_sp<SkXfermode> SkXfermode::Make(Mode mode) { return nullptr; } - return sk_ref_sp(cached[mode].get([=]{ + SkASSERT(SK_ARRAY_COUNT(gProcCoeffs) == kModeCount); + + static SkOnce once[SkXfermode::kLastMode+1]; + static SkXfermode* cached[SkXfermode::kLastMode+1]; + + once[mode]([mode] { ProcCoeff rec = gProcCoeffs[mode]; if (auto xfermode = SkOpts::create_xfermode(rec, mode)) { - return xfermode; + cached[mode] = xfermode; + } else { + cached[mode] = new SkProcCoeffXfermode(rec, mode); } - return (SkXfermode*) new SkProcCoeffXfermode(rec, mode); - })); + }); + return sk_ref_sp(cached[mode]); } SkXfermodeProc SkXfermode::GetProc(Mode mode) { 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); } diff --git a/src/lazy/SkDiscardableMemoryPool.cpp b/src/lazy/SkDiscardableMemoryPool.cpp index 2be4c755f1..d6753def9d 100644 --- a/src/lazy/SkDiscardableMemoryPool.cpp +++ b/src/lazy/SkDiscardableMemoryPool.cpp @@ -9,7 +9,7 @@ #include "SkDiscardableMemoryPool.h" #include "SkImageGenerator.h" #include "SkMutex.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkTInternalLList.h" // Note: @@ -245,11 +245,13 @@ SkDiscardableMemoryPool* SkDiscardableMemoryPool::Create(size_t size, SkMutex* m } SK_DECLARE_STATIC_MUTEX(gMutex); -SK_DECLARE_STATIC_ONCE_PTR(SkDiscardableMemoryPool, global); SkDiscardableMemoryPool* SkGetGlobalDiscardableMemoryPool() { - return global.get([] { - return SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE, - &gMutex); + static SkOnce once; + static SkDiscardableMemoryPool* global; + once([]{ + global = SkDiscardableMemoryPool::Create(SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE, + &gMutex); }); + return global; } diff --git a/src/opts/opts_check_x86.cpp b/src/opts/opts_check_x86.cpp index 2cb2e65bf1..dacb49bc91 100644 --- a/src/opts/opts_check_x86.cpp +++ b/src/opts/opts_check_x86.cpp @@ -13,7 +13,6 @@ #include "SkBlitRow.h" #include "SkBlitRow_opts_SSE2.h" #include "SkCpu.h" -#include "SkOncePtr.h" #include "SkRTConf.h" diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index 72d4690870..8593b39611 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -35,7 +35,7 @@ #include "SkOTTable_hhea.h" #include "SkOTTable_loca.h" #include "SkOTUtils.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include "SkPaint.h" #include "SkPath.h" #include "SkSFNTHeader.h" @@ -778,12 +778,12 @@ static CTFontDrawGlyphsProc* choose_CTFontDrawGlyphs() { return &legacy_CTFontDrawGlyphs; } -SK_DECLARE_STATIC_ONCE_PTR(CTFontDrawGlyphsProc, gCTFontDrawGlyphs); - CGRGBPixel* Offscreen::getCG(const SkScalerContext_Mac& context, const SkGlyph& glyph, CGGlyph glyphID, size_t* rowBytesPtr, bool generateA8FromLCD) { - auto ctFontDrawGlyphs = gCTFontDrawGlyphs.get(choose_CTFontDrawGlyphs); + static SkOnce once; + static CTFontDrawGlyphsProc* ctFontDrawGlyphs; + once([]{ ctFontDrawGlyphs = choose_CTFontDrawGlyphs(); }); if (!fRGBSpace) { //It doesn't appear to matter what color space is specified. diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp index 32a0207c23..0a748d1464 100644 --- a/src/utils/SkEventTracer.cpp +++ b/src/utils/SkEventTracer.cpp @@ -7,7 +7,7 @@ #include "SkAtomics.h" #include "SkEventTracer.h" -#include "SkOncePtr.h" +#include "SkOnce.h" #include <stdlib.h> @@ -39,9 +39,8 @@ class SkDefaultEventTracer : public SkEventTracer { } }; -// We prefer gUserTracer if it's been set, otherwise we fall back on gDefaultTracer. +// We prefer gUserTracer if it's been set, otherwise we fall back on a default tracer; static SkEventTracer* gUserTracer = nullptr; -SK_DECLARE_STATIC_ONCE_PTR(SkDefaultEventTracer, gDefaultTracer); void SkEventTracer::SetInstance(SkEventTracer* tracer) { SkASSERT(nullptr == sk_atomic_load(&gUserTracer, sk_memory_order_acquire)); @@ -54,5 +53,8 @@ SkEventTracer* SkEventTracer::GetInstance() { if (SkEventTracer* tracer = sk_atomic_load(&gUserTracer, sk_memory_order_acquire)) { return tracer; } - return gDefaultTracer.get([]{ return new SkDefaultEventTracer; }); + static SkOnce once; + static SkDefaultEventTracer* defaultTracer; + once([] { defaultTracer = new SkDefaultEventTracer; }); + return defaultTracer; } |