Commit b4ccaf46 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[base] Make PostTask destination explicit in...

[base] Make PostTask destination explicit in /content/public/test/browser_task_environment_unittest.cc

Task APIs v3 will all have an explicit destination. In the past
"default traits" meant ThreadPool. These CLs are thus a no-op
except for the few callers that clearly wanted to post a QuitClosure()
on the current thread (posting a QuitClosure() to a parallel task will
merely bounce it back to the current thread anyways). Those few callers
were migrated to ThreadTaskRunnerHandle::Get().

These changes are thus required to phase out task APIs v2 (post_task.h)
Design doc: https://docs.google.com/document/d/1tssusPykvx3g0gvbvU4HxGyn3MjJlIylnsH13-Tv6s4/edit

This specific change is a subset of
https://chromium-review.googlesource.com/c/chromium/src/+/2216733

This CL was uploaded by git cl split.

R=sky@chromium.org

Bug: 1026641
Change-Id: I87ec188abf4b2e6a359d69409a74bbf90674197c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215918
Auto-Submit: Gabriel Charette <gab@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772277}
parent 910e0efa
......@@ -10,6 +10,7 @@
#include "base/message_loop/message_loop_current.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/test/bind_test_util.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
......@@ -38,8 +39,8 @@ void PostToThreadPool(int iteration, base::subtle::Atomic32* tasks_run) {
if (iteration == kNumHops)
return;
base::PostTask(FROM_HERE,
base::BindOnce(&PostTaskToUIThread, iteration + 1, tasks_run));
base::ThreadPool::PostTask(
FROM_HERE, base::BindOnce(&PostTaskToUIThread, iteration + 1, tasks_run));
}
void PostTaskToUIThread(int iteration, base::subtle::Atomic32* tasks_run) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment