diff options
Diffstat (limited to 'tools/trace')
-rw-r--r-- | tools/trace/SkEventTracingPriv.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/trace/SkEventTracingPriv.cpp b/tools/trace/SkEventTracingPriv.cpp index 42d992cb13..7a9ca2ee80 100644 --- a/tools/trace/SkEventTracingPriv.cpp +++ b/tools/trace/SkEventTracingPriv.cpp @@ -12,7 +12,7 @@ #include "SkCommandLineFlags.h" #include "SkDebugfTracer.h" #include "SkEventTracer.h" -#include "SkTraceEventCommon.h" +#include "SkTraceEvent.h" DEFINE_string(trace, "", "Log trace events in one of several modes:\n" @@ -42,17 +42,17 @@ void initializeEventTracingForTools(const char* traceFlag) { SkAssertResult(SkEventTracer::SetInstance(eventTracer)); } -uint8_t* SkEventTracingCategories::getCategoryGroupEnabled(const char* name) {
- static_assert(0 == offsetof(CategoryState, fEnabled), "CategoryState");
-
- // We ignore the "disabled-by-default-" prefix in our internal tools (though we could honor it)
- if (SkStrStartsWith(name, TRACE_DISABLED_BY_DEFAULT_PREFIX)) {
- name += strlen(TRACE_DISABLED_BY_DEFAULT_PREFIX);
- }
-
- // Chrome's implementation of this API does a two-phase lookup (once without a lock, then again
- // with a lock. But the tracing macros avoid calling these functions more than once per site,
- // so just do something simple (and easier to reason about):
+uint8_t* SkEventTracingCategories::getCategoryGroupEnabled(const char* name) { + static_assert(0 == offsetof(CategoryState, fEnabled), "CategoryState"); + + // We ignore the "disabled-by-default-" prefix in our internal tools + if (SkStrStartsWith(name, TRACE_CATEGORY_PREFIX)) { + name += strlen(TRACE_CATEGORY_PREFIX); + } + + // Chrome's implementation of this API does a two-phase lookup (once without a lock, then again + // with a lock. But the tracing macros avoid calling these functions more than once per site, + // so just do something simple (and easier to reason about): SkAutoMutexAcquire lock(&fMutex); for (int i = 0; i < fNumCategories; ++i) { if (0 == strcmp(name, fCategories[i].fName)) { @@ -71,7 +71,7 @@ uint8_t* SkEventTracingCategories::getCategoryGroupEnabled(const char* name) { return reinterpret_cast<uint8_t*>(&fCategories[fNumCategories++]); } -const char* SkEventTracingCategories::getCategoryGroupName(const uint8_t* categoryEnabledFlag) {
+const char* SkEventTracingCategories::getCategoryGroupName(const uint8_t* categoryEnabledFlag) { if (categoryEnabledFlag) { return reinterpret_cast<const CategoryState*>(categoryEnabledFlag)->fName; } |