Chromium Code Reviews| Index: src/utils/SkEventTracer.cpp |
| diff --git a/src/utils/SkEventTracer.cpp b/src/utils/SkEventTracer.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1155ed06da8a0f4b6195c2f8efd3a6182e6a860e |
| --- /dev/null |
| +++ b/src/utils/SkEventTracer.cpp |
| @@ -0,0 +1,56 @@ |
| +/* |
| + * Copyright 2013 Google Inc. |
|
mtklein
2014/01/29 20:57:55
I bet you can bump this to 2014 now.
|
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#include "SkEventTracer.h" |
| +#include "SkOnce.h" |
| + |
| +namespace skia { |
| +namespace tracing { |
| + |
| +class SkDefaultEventTracer: public SkEventTracer { |
| + virtual TraceEventHandle |
|
mtklein
2014/01/29 20:57:55
Doesn't hurt to tack on SK_OVERRIDE to these.
You
|
| + AddTraceEvent(char phase, |
| + const unsigned char* categoryEnabledFlag, |
| + const char* name, |
| + unsigned long long id, |
| + int numArgs, |
| + const char** argNames, |
| + const unsigned char* argTypes, |
| + const unsigned long long* argValues, |
| + unsigned char flags) { return 0; } |
| + |
| + virtual void |
| + UpdateTraceEventDuration(const unsigned char* categoryEnabledFlag, |
| + const char* name, |
| + tracing::TraceEventHandle) {}; |
| + |
| + virtual const unsigned char* GetCategoryGroupEnabled(const char* name) { |
| + static unsigned char no = 1; |
| + return &no; |
| + }; |
| + virtual const char* GetCategoryGroupName( |
| + const unsigned char* category_group_enabled) { |
| + static const char* dummy = "dummy"; |
| + return dummy; |
| + }; |
| +}; |
| + |
| +SkEventTracer *SkEventTracer::_instance; |
| + |
| +static void intiailize_default_tracer(void**) { |
|
mtklein
2014/01/29 20:57:55
If you're not going to use the argument, we usuall
|
| + SkEventTracer::SetInstance(SkNEW(SkDefaultEventTracer)); |
| +} |
| + |
| +SkEventTracer *SkEventTracer::GetInstance() { |
|
mtklein
2014/01/29 20:57:55
We almost always put the * on the left.
|
| + SK_DECLARE_STATIC_ONCE(once); |
| + SkOnce(&once, intiailize_default_tracer, (void **) NULL); |
| + SkASSERT(NULL != SkEventTracer::_instance); |
| + return SkEventTracer::_instance; |
| +} |
| + |
| +} |
|
mtklein
2014/01/29 20:57:55
If you keep the namespaces, can you add
} // nam
|
| +} |