| Index: third_party/WebKit/Source/platform/TraceEvent.h
|
| diff --git a/third_party/WebKit/Source/platform/TraceEvent.h b/third_party/WebKit/Source/platform/TraceEvent.h
|
| index 01e4edec905443a96d6e8b1fb8a00d14e232de0e..fe656337b7594000f2d31e0b2b7abc0112a0ce6a 100644
|
| --- a/third_party/WebKit/Source/platform/TraceEvent.h
|
| +++ b/third_party/WebKit/Source/platform/TraceEvent.h
|
| @@ -235,6 +235,10 @@
|
| } \
|
| } while (0)
|
|
|
| +// Implementation detail: internal macro to enter and leave a context based on
|
| +// the current scope.
|
| +#define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(categoryGroup, name, context) \
|
| + blink::TraceEvent::TraceScopedContext INTERNAL_TRACE_EVENT_UID(scopedTracer)(categoryGroup, name, context)
|
|
|
| // These values must be in sync with base::debug::TraceLog::CategoryGroupEnabledFlags.
|
| #define ENABLED_FOR_RECORDING (1 << 0)
|
| @@ -623,6 +627,31 @@ private:
|
| IDType m_id;
|
| };
|
|
|
| +using TraceContext = const void*;
|
| +
|
| +class TraceScopedContext {
|
| + WTF_MAKE_NONCOPYABLE(TraceScopedContext);
|
| +
|
| +public:
|
| + TraceScopedContext(const char* categoryGroup, const char* name, TraceContext context)
|
| + : m_categoryGroup(categoryGroup)
|
| + , m_name(name)
|
| + , m_context(context)
|
| + {
|
| + TRACE_EVENT_ENTER_CONTEXT(m_categoryGroup, m_name, m_context);
|
| + }
|
| +
|
| + ~TraceScopedContext()
|
| + {
|
| + TRACE_EVENT_LEAVE_CONTEXT(m_categoryGroup, m_name, m_context);
|
| + }
|
| +
|
| +private:
|
| + const char* m_categoryGroup;
|
| + const char* m_name;
|
| + TraceContext m_context;
|
| +};
|
| +
|
| } // namespace TraceEvent
|
|
|
| } // namespace blink
|
|
|