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

Migrate off base::ThreadPool()-as-a-trait in /ash/assistant

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

Bug: 1026641
Change-Id: I34e0294c917a1331449f2acbdbce7b13e7ad7a72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078425Reviewed-by: default avatarXiaohui Chen <xiaohuic@chromium.org>
Commit-Queue: Xiaohui Chen <xiaohuic@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745730}
parent d52f0c88
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "base/stl_util.h" #include "base/stl_util.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h" #include "mojo/public/cpp/bindings/receiver.h"
#include "ui/aura/client/aura_constants.h" #include "ui/aura/client/aura_constants.h"
...@@ -53,10 +54,8 @@ void EncodeScreenshotAndRunCallback( ...@@ -53,10 +54,8 @@ void EncodeScreenshotAndRunCallback(
mojom::AssistantScreenContextController::RequestScreenshotCallback callback, mojom::AssistantScreenContextController::RequestScreenshotCallback callback,
std::unique_ptr<ui::LayerTreeOwner> layer_owner, std::unique_ptr<ui::LayerTreeOwner> layer_owner,
gfx::Image image) { gfx::Image image) {
base::PostTaskAndReplyWithResult( base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::TaskTraits{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_BLOCKING},
base::BindOnce(&DownsampleAndEncodeImage, std::move(image)), base::BindOnce(&DownsampleAndEncodeImage, std::move(image)),
std::move(callback)); std::move(callback));
} }
......
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