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

Partial Reland [base] Add missing base::ThreadPool() destination to remaining callsites

This is a partial reland of
https://chromium-review.googlesource.com/c/chromium/src/+/1635827
for the task traits additions that were already LGTM'ed.

TBR=fdoray@chromium.org

Bug: 968047
Change-Id: I2dc33aadae040b12e58157c80c343a055ed441f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1762417
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarFrançois Doray <fdoray@chromium.org>
Cr-Commit-Position: refs/heads/master@{#688689}
parent 1713bb50
......@@ -629,7 +629,7 @@ void TestRunner::Run(const std::vector<std::string>& test_names) {
task_runners_.clear();
for (size_t i = 0; i < runner_count_; i++) {
task_runners_.push_back(CreateSequencedTaskRunnerWithTraits(
{MayBlock(), TaskShutdownBehavior::BLOCK_SHUTDOWN}));
{ThreadPool(), MayBlock(), TaskShutdownBehavior::BLOCK_SHUTDOWN}));
ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
BindOnce(&TestRunner::LaunchNextTask, weak_ptr_factory_.GetWeakPtr(),
......
......@@ -190,8 +190,9 @@ void RunCallbackWithCompressedDataFromExtension(
}
// Try and load data from the resource file.
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE},
base::BindOnce(&CompressedDataFromResource, std::move(ext_resource)),
base::BindOnce(&RunCallbackWithCompressedData, size_hint_in_dip,
default_icon_resource, is_placeholder_icon,
......@@ -230,7 +231,9 @@ void RunCallbackWithImageSkia(int size_hint_in_dip,
processed_image.MakeThreadSafe();
base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
FROM_HERE,
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE},
base::BindOnce(&EncodeImage, processed_image),
base::BindOnce(&RunCallbackWithCompressedData, size_hint_in_dip,
default_icon_resource, is_placeholder_icon, icon_effects,
......
......@@ -40,7 +40,9 @@ class TestFilesDataSource : public content::URLDataSource {
const content::WebContents::Getter& wc_getter,
const content::URLDataSource::GotDataCallback& callback) override {
base::PostTaskWithTraits(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
FROM_HERE,
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_BLOCKING},
base::BindOnce(&TestFilesDataSource::ReadFile, base::Unretained(this),
path, callback));
}
......
......@@ -417,7 +417,7 @@ void HeapCollector::ParseAndSaveProfile(
auto task_runner = base::SequencedTaskRunnerHandle::Get();
base::PostTask(
FROM_HERE,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(&HeapCollector::ParseProfileOnThreadPool, task_runner,
weak_factory_.GetWeakPtr(), std::move(parser),
......
......@@ -38,8 +38,8 @@ MetricProvider::MetricProvider(std::unique_ptr<MetricCollector> collector)
// times when the system is not busy. The work performed on the dedicated
// sequence is short and infrequent. Expensive parsing operations are
// executed asynchronously on the thread pool.
collector_task_runner_(
base::CreateSequencedTaskRunner({base::TaskPriority::USER_VISIBLE})),
collector_task_runner_(base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::TaskPriority::USER_VISIBLE})),
metric_collector_(std::move(collector)),
weak_factory_(this) {
metric_collector_->set_profile_done_callback(base::BindRepeating(
......
......@@ -164,7 +164,7 @@ void ChromeExtensionMessageFilter::OnGetExtMessageBundle(
// This blocks tab loading. Priority is inherited from the calling context.
base::PostTaskWithTraits(
FROM_HERE, {base::MayBlock()},
FROM_HERE, {base::ThreadPool(), base::MayBlock()},
base::BindOnce(&ChromeExtensionMessageFilter::OnGetExtMessageBundleAsync,
this, paths_to_load, extension_id, default_locale,
reply_msg));
......
......@@ -67,9 +67,9 @@ base::FilePath CastAudioJson::GetFilePathForTuning() {
}
CastAudioJsonProviderImpl::CastAudioJsonProviderImpl()
: cast_audio_watcher_(
base::SequenceBound<FileWatcher>(base::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::LOWEST}))) {}
: cast_audio_watcher_(base::SequenceBound<FileWatcher>(
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::LOWEST}))) {}
CastAudioJsonProviderImpl::~CastAudioJsonProviderImpl() = default;
......
......@@ -53,8 +53,9 @@ FeedContentDatabase::FeedContentDatabase(
leveldb_proto::ProtoDatabaseProvider* proto_database_provider,
const base::FilePath& database_folder)
: database_status_(InitStatus::kNotInitialized),
task_runner_(base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE})),
task_runner_(
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE})),
storage_database_(proto_database_provider->GetDB<ContentStorageProto>(
leveldb_proto::ProtoDbType::FEED_CONTENT_DATABASE,
database_folder.AppendASCII(kContentDatabaseFolder),
......
......@@ -58,7 +58,8 @@ class FeedContentDatabaseTest : public testing::Test {
std::make_unique<FakeDB<ContentStorageProto>>(&content_db_storage_);
task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE});
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE});
content_db_ = storage_db.get();
feed_db_ = std::make_unique<FeedContentDatabase>(std::move(storage_db),
......
......@@ -38,8 +38,9 @@ FeedJournalDatabase::FeedJournalDatabase(
leveldb_proto::ProtoDatabaseProvider* proto_database_provider,
const base::FilePath& database_folder)
: database_status_(InitStatus::kNotInitialized),
task_runner_(base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE})),
task_runner_(
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE})),
storage_database_(proto_database_provider->GetDB<JournalStorageProto>(
leveldb_proto::ProtoDbType::FEED_JOURNAL_DATABASE,
database_folder.AppendASCII(kJournalDatabaseFolder),
......
......@@ -64,7 +64,8 @@ class FeedJournalDatabaseTest : public testing::Test {
std::make_unique<FakeDB<JournalStorageProto>>(&journal_db_storage_);
task_runner_ = base::CreateSequencedTaskRunnerWithTraits(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE});
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE});
journal_db_ = storage_db.get();
feed_db_ = std::make_unique<FeedJournalDatabase>(std::move(storage_db),
......
......@@ -121,7 +121,8 @@ mojo::PendingRemote<mojom::ProfilingService> LaunchService(
helper) {
mojo::PendingRemote<mojom::ProfilingService> remote;
auto task_runner = base::CreateSingleThreadTaskRunner(
{base::TaskPriority::BEST_EFFORT, base::WithBaseSyncPrimitives()},
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
base::WithBaseSyncPrimitives()},
base::SingleThreadTaskRunnerThreadMode::DEDICATED);
task_runner->PostTask(
FROM_HERE,
......
......@@ -39,7 +39,7 @@ bool GetSourceCode(std::string path, std::string* source_code) {
bool return_value;
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
base::BindOnce(&base::ReadFileToString, src_dir, source_code),
base::BindOnce(&OnSourceFile, run_loop.QuitClosure(), &return_value));
......
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