Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: include/utils/SkEventTracer.h

Issue 136753013: rename tracing parameter to be more consistent with other methods (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/utils/SkEventTracer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
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 #ifndef SkEventTracer_DEFINED 8 #ifndef SkEventTracer_DEFINED
9 #define SkEventTracer_DEFINED 9 #define SkEventTracer_DEFINED
10 10
11 // The class in this header defines the interface between Skia's internal 11 // The class in this header defines the interface between Skia's internal
12 // tracing macros and an external entity (e.g., Chrome) that will consume them. 12 // tracing macros and an external entity (e.g., Chrome) that will consume them.
13 // Such an entity should subclass SkEventTracer and provide an instance of 13 // Such an entity should subclass SkEventTracer and provide an instance of
14 // that event to SkEventTracer::SetInstance. 14 // that event to SkEventTracer::SetInstance.
15 15
16 // If you're looking for the tracing macros to instrument Skia itself, those 16 // If you're looking for the tracing macros to instrument Skia itself, those
17 // live in src/core/SkTraceEvent.h 17 // live in src/core/SkTraceEvent.h
18 18
19 #include "SkTypes.h" 19 #include "SkTypes.h"
20 20
21 // This will mark the trace event as disabled by default. The user will need 21 // This will mark the trace event as disabled by default. The user will need
22 // to explicitly enable the event. 22 // to explicitly enable the event.
23 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name 23 #define TRACE_DISABLED_BY_DEFAULT(name) "disabled-by-default-" name
24 24
25 class SK_API SkEventTracer { 25 class SK_API SkEventTracer {
26 public: 26 public:
27 27
28 typedef uint32_t Handle; 28 typedef uint64_t Handle;
29 29
30 static SkEventTracer* GetInstance(); 30 static SkEventTracer* GetInstance();
31 31
32 static void SetInstance(SkEventTracer* tracer) { 32 static void SetInstance(SkEventTracer* tracer) {
33 SkDELETE(SkEventTracer::gInstance); 33 SkDELETE(SkEventTracer::gInstance);
34 SkEventTracer::gInstance = tracer; 34 SkEventTracer::gInstance = tracer;
35 } 35 }
36 36
37 virtual ~SkEventTracer() { } 37 virtual ~SkEventTracer() { }
38 38
39 // The pointer returned from GetCategoryGroupEnabled() points to a 39 // The pointer returned from GetCategoryGroupEnabled() points to a
40 // value with zero or more of the following bits. Used in this class only. 40 // value with zero or more of the following bits. Used in this class only.
41 // The TRACE_EVENT macros should only use the value as a bool. 41 // The TRACE_EVENT macros should only use the value as a bool.
42 // These values must be in sync with macro values in trace_event.h in chromi um. 42 // These values must be in sync with macro values in trace_event.h in chromi um.
43 enum CategoryGroupEnabledFlags { 43 enum CategoryGroupEnabledFlags {
44 // Category group enabled for the recording mode. 44 // Category group enabled for the recording mode.
45 kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, 45 kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0,
46 // Category group enabled for the monitoring mode. 46 // Category group enabled for the monitoring mode.
47 kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1, 47 kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1,
48 // Category group enabled by SetEventCallbackEnabled(). 48 // Category group enabled by SetEventCallbackEnabled().
49 kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, 49 kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2,
50 }; 50 };
51 51
52 virtual const uint8_t* getCategoryGroupEnabled(const char* name) = 0; 52 virtual const uint8_t* getCategoryGroupEnabled(const char* name) = 0;
53 virtual const char* getCategoryGroupName( 53 virtual const char* getCategoryGroupName(
54 const uint8_t* category_group_enabled) = 0; 54 const uint8_t* categoryEnabledFlag) = 0;
55 55
56 virtual SkEventTracer::Handle 56 virtual SkEventTracer::Handle
57 addTraceEvent(char phase, 57 addTraceEvent(char phase,
58 const uint8_t* categoryEnabledFlag, 58 const uint8_t* categoryEnabledFlag,
59 const char* name, 59 const char* name,
60 uint64_t id, 60 uint64_t id,
61 int32_t numArgs, 61 int32_t numArgs,
62 const char** argNames, 62 const char** argNames,
63 const uint8_t* argTypes, 63 const uint8_t* argTypes,
64 const uint64_t* argValues, 64 const uint64_t* argValues,
65 uint8_t flags) = 0; 65 uint8_t flags) = 0;
66 66
67 virtual void 67 virtual void
68 updateTraceEventDuration(const uint8_t* categoryEnabledFlag, 68 updateTraceEventDuration(const uint8_t* categoryEnabledFlag,
69 const char* name, 69 const char* name,
70 SkEventTracer::Handle handle) = 0; 70 SkEventTracer::Handle handle) = 0;
71 private: 71 private:
72 static SkEventTracer *gInstance; 72 static SkEventTracer *gInstance;
73 }; 73 };
74 74
75 #endif // SkEventTracer_DEFINED 75 #endif // SkEventTracer_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkEventTracer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698