Commit 8d03e0a6 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

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

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

Bug: 1026641
Change-Id: I17edfca297131ab8f59d9f9391a401ec11b30ea9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079077
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745493}
parent fc2c5c04
......@@ -11,7 +11,8 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/ref_counted_memory.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
......@@ -32,17 +33,17 @@ namespace {
scoped_refptr<base::TaskRunner> CreatePrinterHandlerTaskRunner() {
// USER_VISIBLE because the result is displayed in the print preview dialog.
static constexpr base::TaskTraits kTraits = {
base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE};
base::MayBlock(), base::TaskPriority::USER_VISIBLE};
#if defined(USE_CUPS)
// CUPS is thread safe.
return base::CreateTaskRunner(kTraits);
return base::ThreadPool::CreateTaskRunner(kTraits);
#elif defined(OS_WIN)
// Windows drivers are likely not thread-safe.
return base::CreateSingleThreadTaskRunner(kTraits);
return base::ThreadPool::CreateSingleThreadTaskRunner(kTraits);
#else
// Be conservative on unsupported platforms.
return base::CreateSingleThreadTaskRunner(kTraits);
return base::ThreadPool::CreateSingleThreadTaskRunner(kTraits);
#endif
}
......
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