base: Make it possible to replace the MessageLoop's task runner
This patch makes it possible to customize the task posting behavior
of a MessageLoop. More specifically, a client can change the value
returned by MessageLoop::task_runner() as well as
ThreadTaskRunnerHandle::Get() on the target thread. The original task
runner can still be used to post tasks to be run on the message loop.
The Blink/renderer scheduler will use this functionality to manage task
posting on the renderer main thread. This is needed to ensure consistent
ordering of tasks posted through the MessageLoop w.r.t. tasks posted to
the scheduler.
Design doc: https://docs.google.com/a/chromium.org/document/d/1qxdh2I61_aB_Uzh1QgNqvdWFBCL_E65G2smoSySw7KU/edit#
Alex Clarke <alexclarke@chromium.org> also contributed to this patch (https://codereview.chromium.org/
1206893003/).
BUG=465354
Review URL: https://codereview.chromium.org/
998063002
Cr-Commit-Position: refs/heads/master@{#338564}