OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkEventTracer.h" | 8 #include "SkEventTracer.h" |
9 #include "SkOnce.h" | 9 #include "SkOnce.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 }; | 31 }; |
32 virtual const char* getCategoryGroupName( | 32 virtual const char* getCategoryGroupName( |
33 const uint8_t* category_group_enabled) SK_OVERRIDE { | 33 const uint8_t* category_group_enabled) SK_OVERRIDE { |
34 static const char* dummy = "dummy"; | 34 static const char* dummy = "dummy"; |
35 return dummy; | 35 return dummy; |
36 }; | 36 }; |
37 }; | 37 }; |
38 | 38 |
39 SkEventTracer *SkEventTracer::gInstance; | 39 SkEventTracer *SkEventTracer::gInstance; |
40 | 40 |
41 static void intiailize_default_tracer(int) { | 41 static void intialiize_default_tracer(void *current_instance) { |
42 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer)); | 42 if (NULL == current_instance) { |
| 43 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer)); |
| 44 } |
43 } | 45 } |
44 | 46 |
45 static void cleanup_tracer() { | 47 static void cleanup_tracer() { |
46 // calling SetInstance will delete the existing instance. | 48 // calling SetInstance will delete the existing instance. |
47 SkEventTracer::SetInstance(NULL); | 49 SkEventTracer::SetInstance(NULL); |
48 } | 50 } |
49 | 51 |
50 SkEventTracer* SkEventTracer::GetInstance() { | 52 SkEventTracer* SkEventTracer::GetInstance() { |
51 SK_DECLARE_STATIC_ONCE(once); | 53 SK_DECLARE_STATIC_ONCE(once); |
52 SkOnce(&once, intiailize_default_tracer, 0, cleanup_tracer); | 54 SkOnce(&once, |
| 55 intialiize_default_tracer, |
| 56 SkEventTracer::gInstance, |
| 57 cleanup_tracer); |
53 SkASSERT(NULL != SkEventTracer::gInstance); | 58 SkASSERT(NULL != SkEventTracer::gInstance); |
54 return SkEventTracer::gInstance; | 59 return SkEventTracer::gInstance; |
55 } | 60 } |
OLD | NEW |