Commit 52fae3f4 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Migrate off base::ThreadPool()-as-a-trait in /components/upload_list

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

Bug: 1026641
Change-Id: I38da1f6c3416d9f3539129fcb0977d3edc5980e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079151
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745489}
parent 7227ce0d
......@@ -9,15 +9,15 @@
#include <utility>
#include "base/bind.h"
#include "base/task/post_task.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
namespace {
// USER_VISIBLE because loading uploads blocks chrome://crashes,
// chrome://webrtc-logs and the feedback UI. See https://crbug.com/972526.
constexpr base::TaskTraits kLoadingTaskTraits = {
base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING,
base::MayBlock(), base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN};
} // namespace
......@@ -63,7 +63,7 @@ UploadList::~UploadList() = default;
void UploadList::Load(base::OnceClosure callback) {
DCHECK(sequence_checker_.CalledOnValidSequence());
load_callback_ = std::move(callback);
base::PostTaskAndReplyWithResult(
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, kLoadingTaskTraits,
base::BindOnce(&UploadList::LoadUploadList, this),
base::BindOnce(&UploadList::OnLoadComplete, this));
......@@ -74,7 +74,7 @@ void UploadList::Clear(const base::Time& begin,
base::OnceClosure callback) {
DCHECK(sequence_checker_.CalledOnValidSequence());
clear_callback_ = std::move(callback);
base::PostTaskAndReply(
base::ThreadPool::PostTaskAndReply(
FROM_HERE, kLoadingTaskTraits,
base::BindOnce(&UploadList::ClearUploadList, this, begin, end),
base::BindOnce(&UploadList::OnClearComplete, this));
......@@ -86,7 +86,7 @@ void UploadList::CancelLoadCallback() {
void UploadList::RequestSingleUploadAsync(const std::string& local_id) {
DCHECK(sequence_checker_.CalledOnValidSequence());
base::PostTask(
base::ThreadPool::PostTask(
FROM_HERE, kLoadingTaskTraits,
base::BindOnce(&UploadList::RequestSingleUpload, this, local_id));
}
......
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