tracing: Add macros for generating context trace events

These macros can be used to annotate sections of code that are working
on specific trace contexts. For example, to mark a piece of code as
belonging to a particular HTML frame:

  TRACE_EVENT_ENTER_CONTEXT("blink", "FrameContext", &my_frame);
  // Do something with |my_frame|.
  TRACE_EVENT_LEAVE_CONTEXT("blink", "FrameContext", &my_frame);

The patch also adds a scoped helper:

  TraceScopedContext scoped_context("blink", "FrameContext", &my_frame);

For more details see the design doc:

https://docs.google.com/document/d/15BB-suCb9j-nFt55yCFJBJCGzLg2qUm3WaSOPb8APtI/edit?pli=1#heading=h.4lvgp19u6rwx

BUG=546021

Review URL: https://codereview.chromium.org/1499683002

Cr-Original-Commit-Position: refs/heads/master@{#370976}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 29ffcdce7014502105f8d95a97259c910ba3b8be
1 file changed
tree: 87884a421e9e30e3f76d23356af6d053e3186186
  1. trace_event_common.h