Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(485)

Unified Diff: src/utils/SkEventTracer.cpp

Issue 302083003: Clean up SkOnce: (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused 1 == Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ports/SkGlobalInitialization_default.cpp ('k') | src/utils/win/SkDWrite.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/ports/SkGlobalInitialization_default.cpp ('k') | src/utils/win/SkDWrite.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698