OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2013 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkEventTracer.h" |
| 9 #include "SkOnce.h" |
| 10 |
| 11 namespace skia { |
| 12 namespace tracing { |
| 13 |
| 14 class SkDefaultEventTracer: public SkEventTracer { |
| 15 virtual TraceEventHandle |
| 16 AddTraceEvent(char phase, |
| 17 const unsigned char* categoryEnabledFlag, |
| 18 const char* name, |
| 19 unsigned long long id, |
| 20 int numArgs, |
| 21 const char** argNames, |
| 22 const unsigned char* argTypes, |
| 23 const unsigned long long* argValues, |
| 24 unsigned char flags) { return 0; } |
| 25 |
| 26 virtual void |
| 27 UpdateTraceEventDuration(const unsigned char* categoryEnabledFlag, |
| 28 const char* name, |
| 29 tracing::TraceEventHandle) {}; |
| 30 |
| 31 virtual const unsigned char* GetCategoryGroupEnabled(const char* name) { |
| 32 static unsigned char no = 1; |
| 33 return &no; |
| 34 }; |
| 35 virtual const char* GetCategoryGroupName( |
| 36 const unsigned char* category_group_enabled) { |
| 37 static const char* dummy = "dummy"; |
| 38 return dummy; |
| 39 }; |
| 40 }; |
| 41 |
| 42 SkEventTracer *SkEventTracer::_instance; |
| 43 |
| 44 static void intiailize_default_tracer(void**) { |
| 45 SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer)); |
| 46 } |
| 47 |
| 48 SkEventTracer *SkEventTracer::GetInstance() { |
| 49 SK_DECLARE_STATIC_ONCE(once); |
| 50 SkOnce(&once, intiailize_default_tracer, (void **) NULL); |
| 51 SkASSERT(NULL != SkEventTracer::_instance); |
| 52 return SkEventTracer::_instance; |
| 53 } |
| 54 |
| 55 } |
| 56 } |
OLD | NEW |