From 199ba8e19b0cafb37eea3beab162bc4b52728fff Mon Sep 17 00:00:00 2001 From: mtklein Date: Tue, 13 Jan 2015 08:40:23 -0800 Subject: namespace {} trick for SK_DECLARE_STATIC_ONCE Like all our other SK_DECLARE_STATIC_*, it's usually not a thread-safe thing to put inside a function. Adding namespace {} prevents that syntactically. Needs https://codereview.chromium.org/841263004/ to land first. BUG=chromium:447890 No public API changes. TBR=reed@google.com Review URL: https://codereview.chromium.org/806473006 --- src/utils/SkEventTracer.cpp | 2 +- src/utils/win/SkDWrite.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src/utils') diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp index 4c0470b389..ef2a0552b5 100644 --- a/src/utils/SkEventTracer.cpp +++ b/src/utils/SkEventTracer.cpp @@ -51,8 +51,8 @@ static void intialize_default_tracer(SkEventTracer* current_instance) { } +SK_DECLARE_STATIC_ONCE(once); SkEventTracer* SkEventTracer::GetInstance() { - SK_DECLARE_STATIC_ONCE(once); SkOnce(&once, intialize_default_tracer, SkEventTracer::gInstance); SkASSERT(SkEventTracer::gInstance); return SkEventTracer::gInstance; diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp index 7801059187..363ac438d9 100644 --- a/src/utils/win/SkDWrite.cpp +++ b/src/utils/win/SkDWrite.cpp @@ -41,10 +41,9 @@ static void create_dwrite_factory(IDWriteFactory** factory) { } +SK_DECLARE_STATIC_ONCE(once); IDWriteFactory* sk_get_dwrite_factory() { - SK_DECLARE_STATIC_ONCE(once); SkOnce(&once, create_dwrite_factory, &gDWriteFactory); - return gDWriteFactory; } -- cgit v1.2.3