FYI: "TaskScheduler" is no more, long live "task scheduling"

72 views
Skip to first unread message

Gabriel Charette

unread,
May 14, 2019, 4:39:19 PM5/14/19
to Chromium-dev
A quick update on task scheduling:

If you've looked into what backs //base/task/post_task.h recently you might have realized that it grew beyond its initial bounds of being the API to post off-thread tasks to base::TaskScheduler. BrowserThread::UI and IO now also go through post_task.h and are backed by a base::SequenceManager making them "schedulable" (rather than strict FIFOs). base::TaskScheduler no longer being the only source of "scheduling", it was renamed to base::ThreadPool and along with base::SequenceManager makes for the base "task scheduling" infrastructure.

It all lives in //base/task and you should still mostly only need to know about base/task/post_task.h, base/task/task_traits.h, and the various *TaskRunner types.


And I also intend to write docs on testing threading+tasks soon.
Until then, the best tip is : use base::test::ScopedTaskEnvironment and its API; or the content::TestBrowserThreadBundle variant if you need BrowserThreads -- if you're in /blink it gets a bit more complex but we're looking to figure that one out too.

Lastly, if you missed it, take a look at the developer chronicle on Task Scheduling Best Practices :).

Cheers!
Gab
Reply all
Reply to author
Forward
0 new messages