Commit 01748f5e authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate off base::ThreadPool()-as-a-trait in /chrome/browser/chromeos/policy

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

Bug: 1026641
Change-Id: Ie31be4a6fa7de7ffb33681dee388fde3bb97a911
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078663
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarSergey Poromov <poromov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745481}
parent 1a24fba8
......@@ -13,8 +13,8 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/sequenced_task_runner.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "chromeos/cryptohome/cryptohome_parameters.h"
#include "chromeos/cryptohome/cryptohome_util.h"
......@@ -35,9 +35,9 @@ namespace {
// We will abort fresh policy fetch after this time and use cached policy.
const int kPolicyFetchTimeoutSecs = 10;
// Traits for the tasks posted in pre-signin policy fetch. As this blocks
// signin, the tasks have user-visible priority.
constexpr base::TaskTraits kTaskTraits = {base::ThreadPool(), base::MayBlock(),
// Traits for the tasks posted on base::ThreadPool in pre-signin policy fetch.
// As this blocks signin, the tasks have user-visible priority.
constexpr base::TaskTraits kTaskTraits = {base::MayBlock(),
base::TaskPriority::USER_VISIBLE};
} // namespace
......@@ -54,7 +54,7 @@ PreSigninPolicyFetcher::PreSigninPolicyFetcher(
is_active_directory_managed_(is_active_directory_managed),
account_id_(account_id),
auth_key_(auth_key),
task_runner_(base::CreateSequencedTaskRunner(kTaskTraits)) {
task_runner_(base::ThreadPool::CreateSequencedTaskRunner(kTaskTraits)) {
DCHECK(account_id_.GetAccountType() != AccountType::ACTIVE_DIRECTORY ||
is_active_directory_managed_);
}
......
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