Flutter Engine
The Flutter Engine
Classes | Public Member Functions | List of all members
SkEventTracingCategories Class Reference

#include <EventTracingPriv.h>

Public Member Functions

 SkEventTracingCategories ()
 
uint8_t * getCategoryGroupEnabled (const char *name)
 
const char * getCategoryGroupName (const uint8_t *categoryEnabledFlag)
 

Detailed Description

Helper class used by internal implementations of SkEventTracer to manage categories.

Definition at line 22 of file EventTracingPriv.h.

Constructor & Destructor Documentation

◆ SkEventTracingCategories()

SkEventTracingCategories::SkEventTracingCategories ( )
inline

Definition at line 24 of file EventTracingPriv.h.

24: fNumCategories(0) {}

Member Function Documentation

◆ getCategoryGroupEnabled()

uint8_t * SkEventTracingCategories::getCategoryGroupEnabled ( const char *  name)

Definition at line 76 of file EventTracingPriv.cpp.

76 {
77 static_assert(0 == offsetof(CategoryState, fEnabled), "CategoryState");
78
79 // We ignore the "disabled-by-default-" prefix in our internal tools
81 name += strlen(TRACE_CATEGORY_PREFIX);
82 }
83
84 // Chrome's implementation of this API does a two-phase lookup (once without a lock, then again
85 // with a lock. But the tracing macros avoid calling these functions more than once per site,
86 // so just do something simple (and easier to reason about):
87 SkAutoMutexExclusive lock(fMutex);
88 for (int i = 0; i < fNumCategories; ++i) {
89 if (0 == strcmp(name, fCategories[i].fName)) {
90 return reinterpret_cast<uint8_t*>(&fCategories[i]);
91 }
92 }
93
94 if (fNumCategories >= kMaxCategories) {
95 SkDEBUGFAIL("Exhausted event tracing categories. Increase kMaxCategories.");
96 return reinterpret_cast<uint8_t*>(&fCategories[0]);
97 }
98
99 fCategories[fNumCategories].fEnabled =
100 CommandLineFlags::ShouldSkip(FLAGS_traceMatch, name)
101 ? 0
103
104 fCategories[fNumCategories].fName = name;
105 return reinterpret_cast<uint8_t*>(&fCategories[fNumCategories++]);
106}
const char * fName
#define SkDEBUGFAIL(message)
Definition: SkAssert.h:118
static bool SkStrStartsWith(const char string[], const char prefixStr[])
Definition: SkString.h:26
#define TRACE_CATEGORY_PREFIX
Definition: SkTraceEvent.h:129
static bool ShouldSkip(const SkTDArray< const char * > &strings, const char *name)
@ kEnabledForRecording_CategoryGroupEnabledFlags
Definition: SkEventTracer.h:55
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ getCategoryGroupName()

const char * SkEventTracingCategories::getCategoryGroupName ( const uint8_t *  categoryEnabledFlag)

Definition at line 108 of file EventTracingPriv.cpp.

108 {
109 if (categoryEnabledFlag) {
110 return reinterpret_cast<const CategoryState*>(categoryEnabledFlag)->fName;
111 }
112 return nullptr;
113}

The documentation for this class was generated from the following files: