content: Replace uses of BrowserThread task posting with post_task.h API

This patch updates callsites of BrowserThread task posting methods to
use the post_task.h API instead.

Background: We're changing the way tasks are posted to a BrowserThread,
see PSA [1] and design doc [2]. This unifies the way tasks are posted
and paves the way for annotating tasks with task types and other
attributes that can be used to prioritize tasks in the future browser
UI thread scheduler (design doc [3]).

This CL changes callsites of the following forms:
(a) BrowserThread::Post*Task(BrowserThread::UI/IO, ..) to
    base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI/IO}, ..),
(b) BrowserThread::GetTaskRunnerForThread(BrowserThread::UI/IO) to

It also adds necessary includes. These mechanical changes were applied
by a script.

Tasks posted with the same BrowserThread::ID trait (via
PostTaskWithTraits or TaskRunners obtained from
Create*TaskRunnerWithTraits) will still execute in the order they
were posted, see [4].


Bug: 878356
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:linux_vr;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I37526c8e75630ee7bec29421276094a30e903894
Reviewed-by: Eric Seckler <>
Reviewed-by: Vaclav Brozek <>
Reviewed-by: Alex Clarke <>
Reviewed-by: Sami Kyöstilä <>
Commit-Queue: Eric Seckler <>
Cr-Original-Commit-Position: refs/heads/master@{#592750}
Cr-Mirrored-Commit: 8652dcd5d8f35d68f105136b3857e9b54148c31b
1 file changed