aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkTraceEvent.h
diff options
context:
space:
mode:
authorGravatar Brian Osman <brianosman@google.com>2017-07-26 09:36:09 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-26 14:22:19 +0000
commit39c08ac3be30f9956cea7c5e4fd9a1d86e993a65 (patch)
tree0a51e1be04f6f4bbbc30e2082019316a43d4fbbf /src/core/SkTraceEvent.h
parent9ac801c12c48b67b48e5a8ef2876a093b7de73fc (diff)
Automatically prepend "disabled-by-default-" to TRACE categories
Ensures that all Skia events are disabled by default in Chrome, and eliminates redundant typing. Bug: skia: Change-Id: I289c5e5a01084fcf4cccf512da65a4727f4aeca2 Reviewed-on: https://skia-review.googlesource.com/26880 Commit-Queue: Mike Klein <mtklein@chromium.org> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/core/SkTraceEvent.h')
-rw-r--r--src/core/SkTraceEvent.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/core/SkTraceEvent.h b/src/core/SkTraceEvent.h
index 116330dcb5..d4d0883a23 100644
--- a/src/core/SkTraceEvent.h
+++ b/src/core/SkTraceEvent.h
@@ -78,6 +78,10 @@
// Defines visibility for classes in trace_event.h
#define TRACE_EVENT_API_CLASS_EXPORT SK_API
+// We prepend this string to all category names, so that ALL Skia trace events are
+// disabled by default when tracing in Chrome.
+#define TRACE_CATEGORY_PREFIX "disabled-by-default-"
+
////////////////////////////////////////////////////////////////////////////////
// Implementation detail: trace event macros create temporary variables
@@ -97,20 +101,18 @@
#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \
category_group, atomic, category_group_enabled) \
category_group_enabled = \
- reinterpret_cast<const uint8_t*>(TRACE_EVENT_API_ATOMIC_LOAD( \
- atomic)); \
+ reinterpret_cast<const uint8_t*>(TRACE_EVENT_API_ATOMIC_LOAD(atomic)); \
if (!category_group_enabled) { \
- category_group_enabled = \
- TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \
+ category_group_enabled = TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group); \
TRACE_EVENT_API_ATOMIC_STORE(atomic, \
- reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>( \
- category_group_enabled)); \
+ reinterpret_cast<TRACE_EVENT_API_ATOMIC_WORD>(category_group_enabled)); \
}
#define INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group) \
static TRACE_EVENT_API_ATOMIC_WORD INTERNAL_TRACE_EVENT_UID(atomic) = 0; \
const uint8_t* INTERNAL_TRACE_EVENT_UID(category_group_enabled); \
- INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES(category_group, \
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO_CUSTOM_VARIABLES( \
+ TRACE_CATEGORY_PREFIX category_group, \
INTERNAL_TRACE_EVENT_UID(atomic), \
INTERNAL_TRACE_EVENT_UID(category_group_enabled));