Index: src/utils/SkEventTracer.cpp |
diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp |
index 529fca3519675aecf41185f9685e61cb62014c4b..65e8372395958449077aeb1a9c1590667ee91e36 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; |
} |