Commit 7fddf9c5 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate off base::ThreadPool()-as-a-trait in /chrome/browser/ui/ash

This CL is a logical no-op.

It manually covers the use cases the script
(https://crbug.com/1026641#c22) didn't cover in
https://chromium-review.googlesource.com/c/chromium/src/+/2026350.

A few of the affected files were also migrated to
content::GetUIThreadTaskRunner() whenever surrounding code consistency
was at stake (but the bulk of that migration is staged to happen after
this one so this wasn't a priority in this batch).

Most files intentionally kept base/task/post_task.h as an include. It is
still required because of a cyclical dependency during the migration
preventing base/task/thread_pool.h from implicitly providing
base/task/task_traits.h to its users (callers that explicitly store
TaskTraits and include task_traits.h don't have this problem). The
post_task.h include will be cleaned up in a later phase.

This CL was uploaded by git cl split.

R=sky@chromium.org

Bug: 1026641
Change-Id: If132c13d94dcca692a7f8a8fc32c34522ac4b33f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078779
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745473}
parent e501b715
......@@ -65,7 +65,7 @@ const char kImageClipboardFormatSuffix[] = "'>";
// User is waiting for the screenshot-taken notification, hence USER_VISIBLE.
constexpr base::TaskTraits kBlockingTaskTraits = {
base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN};
ChromeScreenshotGrabber* g_chrome_screenshot_grabber_instance = nullptr;
......@@ -150,7 +150,7 @@ class ScreenshotGrabberNotificationDelegate
case BUTTON_COPY_TO_CLIPBOARD: {
// To avoid keeping the screenshot image in memory, re-read the
// screenshot file and copy it to the clipboard.
base::PostTask(
base::ThreadPool::PostTask(
FROM_HERE, kBlockingTaskTraits,
base::BindOnce(&ReadFileAndCopyToClipboardLocal, screenshot_path_));
break;
......@@ -486,7 +486,7 @@ void ChromeScreenshotGrabber::ReadScreenshotFileForPreview(
const base::FilePath& screenshot_path) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::PostTaskAndReplyWithResult(
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, kBlockingTaskTraits,
base::BindOnce(&ReadFileToString, screenshot_path),
base::BindOnce(&ChromeScreenshotGrabber::DecodeScreenshotFileForPreview,
......
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