base: Make it possible to replace the MessageLoop's task runner
commit85f43a3185f38eb89c63ad108fd1b73000e0ac56
authorskyostil <skyostil@chromium.org>
Mon, 13 Jul 2015 21:41:17 +0000 (13 14:41 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Jul 2015 21:42:00 +0000 (13 21:42 +0000)
treeadd5f3edc3538a6f508e82c69c6bb74604f74360
parentcffff3e63803ca59605ba38c05dbf684f160d43c
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}
base/message_loop/message_loop.cc
base/message_loop/message_loop.h
base/message_loop/message_loop_unittest.cc