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 "SkAtomics.h" | 8 #include "../private/SkAtomics.h" |
9 #include "SkEventTracer.h" | 9 #include "SkEventTracer.h" |
10 #include "SkOncePtr.h" | 10 #include "SkOncePtr.h" |
11 | 11 |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 | 13 |
14 class SkDefaultEventTracer : public SkEventTracer { | 14 class SkDefaultEventTracer : public SkEventTracer { |
15 SkEventTracer::Handle | 15 SkEventTracer::Handle |
16 addTraceEvent(char phase, | 16 addTraceEvent(char phase, |
17 const uint8_t* categoryEnabledFlag, | 17 const uint8_t* categoryEnabledFlag, |
18 const char* name, | 18 const char* name, |
(...skipping 30 matching lines...) Expand all Loading... |
49 // An atomic load during process shutdown is probably overkill, but safe ove
rkill. | 49 // An atomic load during process shutdown is probably overkill, but safe ove
rkill. |
50 atexit([]() { delete sk_atomic_load(&gUserTracer, sk_memory_order_acquire);
}); | 50 atexit([]() { delete sk_atomic_load(&gUserTracer, sk_memory_order_acquire);
}); |
51 } | 51 } |
52 | 52 |
53 SkEventTracer* SkEventTracer::GetInstance() { | 53 SkEventTracer* SkEventTracer::GetInstance() { |
54 if (SkEventTracer* tracer = sk_atomic_load(&gUserTracer, sk_memory_order_acq
uire)) { | 54 if (SkEventTracer* tracer = sk_atomic_load(&gUserTracer, sk_memory_order_acq
uire)) { |
55 return tracer; | 55 return tracer; |
56 } | 56 } |
57 return gDefaultTracer.get([]{ return new SkDefaultEventTracer; }); | 57 return gDefaultTracer.get([]{ return new SkDefaultEventTracer; }); |
58 } | 58 } |
OLD | NEW |