Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | |
| 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 #ifndef EventTracer_h | |
|
mtklein
2014/01/29 20:57:55
SkEventTracer_DEFINED
humper
2014/01/29 21:29:09
Done.
| |
| 9 #define EventTracer_h | |
| 10 | |
| 11 #include "SkTypes.h" | |
| 12 | |
|
mtklein
2014/01/29 20:57:55
I'm getting the feeling users aren't supposed to e
humper
2014/01/29 21:29:09
Sure -- this isn't a standard skia user-facing API
| |
| 13 // This will mark the trace event as disabled by default. The user will need | |
| 14 // to explicitly enable the event. | |
| 15 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name | |
|
mtklein
2014/01/29 20:57:55
Do we not double-define this? Also in SkTraceEven
humper
2014/01/29 21:29:09
Done.
| |
| 16 | |
| 17 namespace skia { | |
|
mtklein
2014/01/29 20:57:55
I don't mind namespace namespacing or Sk namespaci
humper
2014/01/29 21:29:09
I'll remove the namespaces.
| |
| 18 namespace tracing { | |
| 19 | |
| 20 typedef uint32_t TraceEventHandle; | |
| 21 | |
| 22 // FIXME: Make these global variables thread-safe. Make a value update atomic. | |
| 23 SK_API extern long* traceSamplingState[3]; | |
|
mtklein
2014/01/29 20:57:55
I don't see where we need this here?
humper
2014/01/29 21:29:09
Deleted. I'll reintroduce it when I tackle the pa
| |
| 24 | |
| 25 class SK_API SkEventTracer { | |
| 26 public: | |
| 27 | |
| 28 static SkEventTracer* GetInstance(); | |
| 29 | |
| 30 static void SetInstance(SkEventTracer* tracer) { | |
|
mtklein
2014/01/29 20:57:55
Can this be private? Who calls it?
humper
2014/01/29 21:29:09
Chrome will call it.
| |
| 31 SkDELETE(SkEventTracer::_instance); | |
| 32 SkEventTracer::_instance = tracer; | |
| 33 } | |
| 34 | |
| 35 virtual ~SkEventTracer() { SkDELETE(SkEventTracer::_instance); } | |
|
mtklein
2014/01/29 20:57:55
Does this ever get called? Is it not an infinite
humper
2014/01/29 21:29:09
Good catch. Will move to SkOnce.
| |
| 36 | |
| 37 // The pointer returned from GetCategoryGroupEnabled() points to a | |
| 38 // value with zero or more of the following bits. Used in this class only. | |
| 39 // The TRACE_EVENT macros should only use the value as a bool. | |
| 40 // These values must be in sync with macro values in trace_event.h in chromi um. | |
| 41 enum CategoryGroupEnabledFlags { | |
|
mtklein
2014/01/29 20:57:55
We'd normally call these kEnabledForRecording_Cate
humper
2014/01/29 21:29:09
As long as the numbers match Chromium, we can call
| |
| 42 // Category group enabled for the recording mode. | |
| 43 ENABLED_FOR_RECORDING = 1 << 0, | |
| 44 // Category group enabled for the monitoring mode. | |
| 45 ENABLED_FOR_MONITORING = 1 << 1, | |
| 46 // Category group enabled by SetEventCallbackEnabled(). | |
| 47 ENABLED_FOR_EVENT_CALLBACK = 1 << 2, | |
| 48 }; | |
| 49 | |
| 50 virtual const unsigned char* GetCategoryGroupEnabled(const char* name) = 0; | |
|
mtklein
2014/01/29 20:57:55
So there's one global SkEventTracer that's an inte
mtklein
2014/01/29 20:57:55
These methods all want to be firstLetterLowercase.
humper
2014/01/29 21:29:09
Sure. is that necessary since SkEventTracer is pu
humper
2014/01/29 21:29:09
Done.
| |
| 51 virtual const char* GetCategoryGroupName( | |
| 52 const unsigned char* category_group_enabled) = 0; | |
| 53 | |
| 54 virtual TraceEventHandle | |
| 55 AddTraceEvent(char phase, | |
|
mtklein
2014/01/29 20:57:55
I'm getting a little thrown by the types here
som
humper
2014/01/29 21:29:09
Done.
| |
| 56 const unsigned char* categoryEnabledFlag, | |
| 57 const char* name, | |
| 58 unsigned long long id, | |
| 59 int numArgs, | |
| 60 const char** argNames, | |
| 61 const unsigned char* argTypes, | |
| 62 const unsigned long long* argValues, | |
| 63 unsigned char flags) = 0; | |
| 64 | |
| 65 virtual void | |
| 66 UpdateTraceEventDuration(const unsigned char* categoryEnabledFlag, | |
| 67 const char* name, | |
| 68 tracing::TraceEventHandle) = 0; | |
| 69 private: | |
| 70 static SkEventTracer *_instance; | |
|
mtklein
2014/01/29 20:57:55
->
static SkEventTracer* fInstance;
or
static S
humper
2014/01/29 21:29:09
Done.
| |
| 71 }; | |
| 72 | |
| 73 } // namespace tracing | |
| 74 } // namespace skia | |
| 75 | |
| 76 #endif // EventTracer_h | |
| OLD | NEW |