Commit 8108d510 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[base] Make PostTask destination explicit in /chrome/browser/win

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=pmonette@chromium.org

Bug: 1026641
Change-Id: I828d0534b9b7fb7c988994a07e3e762500e934b9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2215915
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarPatrick Monette <pmonette@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772402}
parent 44abbc31
......@@ -19,7 +19,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/win/com_init_util.h"
#include "base/win/scoped_variant.h"
......@@ -83,13 +83,13 @@ TaskbarIconFinder::TaskbarIconFinder(
: result_callback_(std::move(result_callback)) {
DCHECK(result_callback_);
// Since all threads servicing the worker pool backing post_task.h initialize
// COM into the MTA and only one task is needed for this job, it is sufficient
// to post a simple task here. Should automation event handlers be needed or
// more than one task, care must be taken to follow proper threading rules as
// required for automation clients.
base::PostTask(FROM_HERE,
base::BindOnce(&TaskbarIconFinder::RunOnComTask,
// Since all threads servicing the base::ThreadPool initialize COM into the
// MTA and only one task is needed for this job, it is sufficient to post a
// simple task here. Should automation event handlers be needed or more than
// one task, care must be taken to follow proper threading rules as required
// for automation clients.
base::ThreadPool::PostTask(
FROM_HERE, base::BindOnce(&TaskbarIconFinder::RunOnComTask,
base::SequencedTaskRunnerHandle::Get(),
base::Unretained(this)));
}
......
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