Clear PostTaskAndReply task on the destination thread

This is the behavior-changing part of base::TaskRunner migration from
base::Callback to base::OnceCallback.
In the previous code, PostTaskAndReply and its family guarantee that
|task| is destroyed on the origin thread. If that is not possible, PTAR
leaks |task|. However, it's hard to keep that with OnceCallback, and the
behavior makes less sense on Blink classes, since most of its types are
thread-unsafe and need special handling for thread hop.
Destroying the bound object on the original thread requires extra
thread hop on the bound object just.

On the new code, |task| is destroyed on the target thread unless the
caller holds a reference on the origin thread.

BUG=680359

Review-Url: https://codereview.chromium.org/2657603004
Cr-Commit-Position: refs/heads/master@{#460821}


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