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