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-Commit-Position: refs/heads/master@{#370976}


CrOS-Libchrome-Original-Commit: 29ffcdce7014502105f8d95a97259c910ba3b8be
3 files changed
tree: 310b408b00ede9ef654639c4703d624132959e03
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. device/
  6. ipc/
  7. mojo/
  8. testing/
  9. third_party/
  10. ui/