Skip to content

Commit

Permalink
Ensure that objects on stack that close traces have unique variable n…
Browse files Browse the repository at this point in the history
…ames. (flutter#6298)
  • Loading branch information
chinmaygarde authored Sep 22, 2018
1 parent f3a3d0c commit 57fd394
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fml/trace_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@

#ifndef TRACE_EVENT_HIDE_MACROS

#define __FML__TOKEN_CAT__(x, y) x##y
#define __FML__TOKEN_CAT__2(x, y) __FML__TOKEN_CAT__(x, y)
#define __FML__AUTO_TRACE_END(name) \
::fml::tracing::ScopedInstantEnd __FML__TOKEN_CAT__2(__trace_end_, \
__LINE__)(name);

#define TRACE_EVENT0(category_group, name) \
::fml::tracing::TraceEvent0(category_group, name); \
::fml::tracing::ScopedInstantEnd __trace_end0_##__LINE__(name);
__FML__AUTO_TRACE_END(name)

#define TRACE_EVENT1(category_group, name, arg1_name, arg1_val) \
::fml::tracing::TraceEvent1(category_group, name, arg1_name, arg1_val); \
::fml::tracing::ScopedInstantEnd __trace_end1_##__LINE__(name);
__FML__AUTO_TRACE_END(name)

#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, \
arg2_val) \
::fml::tracing::TraceEvent2(category_group, name, arg1_name, arg1_val, \
arg2_name, arg2_val); \
::fml::tracing::ScopedInstantEnd __trace_end2_##__LINE__(name);
__FML__AUTO_TRACE_END(name)

#define TRACE_EVENT_ASYNC_BEGIN0(category_group, name, id) \
::fml::tracing::TraceEventAsyncBegin0(category_group, name, id);
Expand Down

0 comments on commit 57fd394

Please sign in to comment.