Commit 23f20ca1 authored by Sami Kyostila's avatar Sami Kyostila Committed by Commit Bot

base/trace_event: Avoid shadowing local variable in trace event

Wrap the trace event handle's name in a unique identifier to avoid
shadowing a variable called |h| in the enclosing scope.

Bug: 1119816
Change-Id: I7a247291b99aba5a3c10c6d1144d373b57af35d1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2414254
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Sami Kyöstilä <skyostil@chromium.org>
Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807804}
parent 2346288a
......@@ -259,7 +259,7 @@
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
base::trace_event::TraceEventHandle h = \
base::trace_event::TraceEventHandle INTERNAL_TRACE_EVENT_UID(h) = \
trace_event_internal::AddTraceEvent( \
TRACE_EVENT_PHASE_COMPLETE, \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
......@@ -267,7 +267,8 @@
TRACE_EVENT_FLAG_NONE, trace_event_internal::kNoId, \
##__VA_ARGS__); \
INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
INTERNAL_TRACE_EVENT_UID(h)); \
}
#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLAGS(category_group, name, \
......@@ -275,14 +276,15 @@
INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
trace_event_internal::ScopedTracer INTERNAL_TRACE_EVENT_UID(tracer); \
if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED()) { \
base::trace_event::TraceEventHandle h = \
base::trace_event::TraceEventHandle INTERNAL_TRACE_EVENT_UID(h) = \
trace_event_internal::AddTraceEvent( \
TRACE_EVENT_PHASE_COMPLETE, \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
flags, trace_event_internal::kNoId, ##__VA_ARGS__); \
INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
INTERNAL_TRACE_EVENT_UID(h)); \
}
#define INTERNAL_TRACE_EVENT_ADD_SCOPED_WITH_FLOW(category_group, name, \
......@@ -293,14 +295,15 @@
trace_event_internal::TraceID trace_event_bind_id((bind_id)); \
unsigned int trace_event_flags = \
flow_flags | trace_event_bind_id.id_flags(); \
base::trace_event::TraceEventHandle h = \
base::trace_event::TraceEventHandle INTERNAL_TRACE_EVENT_UID(h) = \
trace_event_internal::AddTraceEvent( \
TRACE_EVENT_PHASE_COMPLETE, \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
trace_event_internal::kGlobalScope, trace_event_internal::kNoId, \
trace_event_flags, trace_event_bind_id.raw_id(), ##__VA_ARGS__); \
INTERNAL_TRACE_EVENT_UID(tracer).Initialize( \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, h); \
INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
INTERNAL_TRACE_EVENT_UID(h)); \
}
// Implementation detail: internal macro to create static category and add
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment