diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ports/SkGlobalInitialization_chromium.cpp | 5 | ||||
-rw-r--r-- | src/ports/SkGlobalInitialization_default.cpp | 5 | ||||
-rw-r--r-- | src/utils/SkEventTracer.cpp | 19 | ||||
-rw-r--r-- | src/utils/win/SkDWrite.cpp | 14 |
4 files changed, 21 insertions, 22 deletions
diff --git a/src/ports/SkGlobalInitialization_chromium.cpp b/src/ports/SkGlobalInitialization_chromium.cpp index 37e5450e19..f42b272f18 100644 --- a/src/ports/SkGlobalInitialization_chromium.cpp +++ b/src/ports/SkGlobalInitialization_chromium.cpp @@ -62,7 +62,7 @@ #include "SkMatrixImageFilter.h" #include "SkXfermodeImageFilter.h" -static void InitializeFlattenables(int*) { +static void InitializeFlattenables() { SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBicubicImageFilter) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) @@ -122,7 +122,6 @@ static void InitializeFlattenables(int*) { } void SkFlattenable::InitializeFlattenablesIfNeeded() { - int dummy; SK_DECLARE_STATIC_ONCE(once); - SkOnce(&once, InitializeFlattenables, &dummy); + SkOnce(&once, InitializeFlattenables); } diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp index 949decd018..ce42ca5aad 100644 --- a/src/ports/SkGlobalInitialization_default.cpp +++ b/src/ports/SkGlobalInitialization_default.cpp @@ -62,7 +62,7 @@ #include "SkMatrixImageFilter.h" #include "SkXfermodeImageFilter.h" -static void InitializeFlattenables(int*) { +static void InitializeFlattenables() { SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkAvoidXfermode) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBicubicImageFilter) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) @@ -123,7 +123,6 @@ static void InitializeFlattenables(int*) { } void SkFlattenable::InitializeFlattenablesIfNeeded() { - int dummy; SK_DECLARE_STATIC_ONCE(once); - SkOnce(&once, InitializeFlattenables, &dummy); + SkOnce(&once, InitializeFlattenables); } diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp index 529fca3519..65e8372395 100644 --- a/src/utils/SkEventTracer.cpp +++ b/src/utils/SkEventTracer.cpp @@ -36,25 +36,24 @@ class SkDefaultEventTracer: public SkEventTracer { }; }; -SkEventTracer *SkEventTracer::gInstance; +SkEventTracer* SkEventTracer::gInstance; -static void intialiize_default_tracer(void *current_instance) { +static void cleanup_tracer() { + // calling SetInstance will delete the existing instance. + SkEventTracer::SetInstance(NULL); +} + +static void intialize_default_tracer(SkEventTracer* current_instance) { if (NULL == current_instance) { SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer)); } + atexit(cleanup_tracer); } -static void cleanup_tracer() { - // calling SetInstance will delete the existing instance. - SkEventTracer::SetInstance(NULL); -} SkEventTracer* SkEventTracer::GetInstance() { SK_DECLARE_STATIC_ONCE(once); - SkOnce(&once, - intialiize_default_tracer, - SkEventTracer::gInstance, - cleanup_tracer); + SkOnce(&once, intialize_default_tracer, SkEventTracer::gInstance); SkASSERT(NULL != SkEventTracer::gInstance); return SkEventTracer::gInstance; } diff --git a/src/utils/win/SkDWrite.cpp b/src/utils/win/SkDWrite.cpp index 16e8ddc4d0..87826b5194 100644 --- a/src/utils/win/SkDWrite.cpp +++ b/src/utils/win/SkDWrite.cpp @@ -14,6 +14,12 @@ static IDWriteFactory* gDWriteFactory = NULL; +static void release_dwrite_factory() { + if (gDWriteFactory) { + gDWriteFactory->Release(); + } +} + static void create_dwrite_factory(IDWriteFactory** factory) { typedef decltype(DWriteCreateFactory)* DWriteCreateFactoryProc; DWriteCreateFactoryProc dWriteCreateFactoryProc = reinterpret_cast<DWriteCreateFactoryProc>( @@ -31,17 +37,13 @@ static void create_dwrite_factory(IDWriteFactory** factory) { __uuidof(IDWriteFactory), reinterpret_cast<IUnknown**>(factory)), "Could not create DirectWrite factory."); + atexit(release_dwrite_factory); } -static void release_dwrite_factory() { - if (gDWriteFactory) { - gDWriteFactory->Release(); - } -} IDWriteFactory* sk_get_dwrite_factory() { SK_DECLARE_STATIC_ONCE(once); - SkOnce(&once, create_dwrite_factory, &gDWriteFactory, release_dwrite_factory); + SkOnce(&once, create_dwrite_factory, &gDWriteFactory); return gDWriteFactory; } |