Move PendingTask::task_backtrace management completely to TaskAnnotator.

This fixes 3 things:
 1) No longer need a friended private variable on MessageLoop
    (this facilitates crbug.com/825327)
 2) Support backtraces that go through TaskScheduler (and eventual other
    TaskAnnotator users)
 3) Support backtraces for tasks posted when returning from a nested
    loop (MessageLoop would previously set the field to null rather than
    "previous" when returning from a task).

New TaskAnnotatorBacktraceIntegrationTests are largely based on previous
PendingTaskTests (plus testing support beyond simple MessageLoop/Thread).

Prefered making PendingTask::task_backtrace mutable to forcing all
PostTask annotations (TaskAnnotator::DidQueueTask and TaskTracker::WillPostTask)
to use a non-const pointer given this doesn't really modify the state of
the PendingTask but rather some internal tracing state.

This also revealed issue 826902.

Bug: 825987, 825327, 826902
Change-Id: Iae24c8d8745a6dadb2185f5c581fb1ff1d5b3f23
Reviewed-on: https://chromium-review.googlesource.com/982496
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Reviewed-by: kylechar <kylechar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#548512}

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