Commit 9fbaf941 authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

[base] Migrate callers to base::ThreadPool:: redux

This a rerun of the same script as in
https://chromium-review.googlesource.com/c/chromium/src/+/2026350
on r771943 this time.

TBR=fdoray@chromium.org

Bug: 1026641
Change-Id: I9d32d1262b0f0e1eaa771358cb77d837c3d3467f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2217115Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772105}
parent efde92ce
......@@ -479,9 +479,9 @@ void UpdatePwaLaunchersForProfile(const base::FilePath& profile_dir) {
}
}
base::PostTask(
base::ThreadPool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT,
{base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN, base::MayBlock()},
base::BindOnce(&web_app::UpdatePwaLaunchers,
std::move(pwa_launcher_paths)));
......@@ -686,9 +686,8 @@ void ChromeBrowserMainPartsWin::PostBrowserStart() {
// Write current executable path to the User Data directory to inform
// Progressive Web App launchers, which run from within the User Data
// directory, which chrome.exe to launch from.
base::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(&web_app::WriteChromePathToLastBrowserFile,
user_data_dir()));
......@@ -703,9 +702,8 @@ void ChromeBrowserMainPartsWin::PostBrowserStart() {
}
// Record the result of the latest Progressive Web App launcher launch.
base::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::ThreadPool::PostTask(
FROM_HERE, {base::TaskPriority::BEST_EFFORT, base::MayBlock()},
base::BindOnce(&web_app::RecordPwaLauncherResult));
base::ImportantFileWriterCleaner::GetInstance().Start();
......
......@@ -141,9 +141,9 @@ void UserSessionInitializer::InitRlz(Profile* profile) {
&UserSessionInitializer::InitRlz, weak_factory_.GetWeakPtr(), profile));
return;
}
base::PostTaskAndReplyWithResult(
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT,
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
base::BindOnce(&CollectRlzParams),
base::BindOnce(&UserSessionInitializer::InitRlzImpl,
......
......@@ -16,6 +16,7 @@
#include "base/metrics/field_trial_params.h"
#include "base/optional.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/version.h"
#include "chrome/browser/chromeos/power/ml/smart_dim/download_worker.h"
#include "chrome/browser/chromeos/power/ml/smart_dim/metrics.h"
......@@ -130,9 +131,8 @@ void SmartDimComponentInstallerPolicy::ComponentReady(
DVLOG(1) << "Component ready, version " << version.GetString() << " in "
<< install_dir.value();
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(
&ReadComponentFiles, install_dir.Append(kSmartDimMetaJsonFileName),
install_dir.Append(kSmartDimFeaturePreprocessorConfigFileName),
......
......@@ -110,8 +110,8 @@ DownloadProtectionService::DownloadProtectionService(
download_request_timeout_ms_(kDownloadRequestTimeoutMs),
feedback_service_(new DownloadFeedbackService(
sb_service_ ? sb_service_->GetURLLoaderFactory() : nullptr,
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT})
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::BEST_EFFORT})
.get())),
whitelist_sample_rate_(kWhitelistDownloadSampleRate),
weak_ptr_factory_(this) {
......
......@@ -9,6 +9,7 @@
#include "base/files/file_path.h"
#include "base/strings/string_util.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "components/leveldb_proto/public/proto_database_provider.h"
......@@ -107,9 +108,8 @@ TabStateDB::TabStateDB(
proto_database_provider->GetDB<tab_state_db::TabStateContentProto>(
leveldb_proto::ProtoDbType::TAB_STATE_DATABASE,
profile_directory.AppendASCII(kTabStateDBFolder),
base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE}))) {
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE}))) {
storage_database_->Init(base::BindOnce(&TabStateDB::OnDatabaseInitialized,
weak_ptr_factory_.GetWeakPtr()));
}
......
......@@ -8,6 +8,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/task/thread_pool.h"
#include "base/test/task_environment.h"
#include "components/leveldb_proto/testing/fake_db.h"
#include "testing/gmock/include/gmock/gmock.h"
......@@ -40,8 +41,8 @@ class TabStateDBTest : public testing::Test {
content_db_ = storage_db.get();
tab_state_db_ = base::WrapUnique(new TabStateDB(
std::move(storage_db),
base::CreateSequencedTaskRunner({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE})));
base::ThreadPool::CreateSequencedTaskRunner(
{base::MayBlock(), base::TaskPriority::USER_VISIBLE})));
}
// Wait for all tasks to be cleared off the queue
......
......@@ -274,8 +274,8 @@ void CrOSActionRecorder::Init(Profile* profile) {
model_dir_ =
profile->GetPath().AppendASCII(CrOSActionRecorder::kActionHistoryDir);
task_runner_ = base::CreateSequencedTaskRunner(
{base::ThreadPool(), base::TaskPriority::BEST_EFFORT, base::MayBlock(),
task_runner_ = base::ThreadPool::CreateSequencedTaskRunner(
{base::TaskPriority::BEST_EFFORT, base::MayBlock(),
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
// Delete all cros action log if it's disabled.
......
......@@ -20,6 +20,7 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/shell_integration_win.h"
#include "chrome/browser/web_applications/components/web_app_helpers.h"
#include "chrome/browser/web_applications/components/web_app_id.h"
......@@ -198,10 +199,8 @@ void RegisterShortcutsMenuWithOs(
const AppId& app_id,
const base::FilePath& profile_path,
const std::vector<WebApplicationShortcutInfo>& shortcuts) {
base::PostTask(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(),
base::TaskShutdownBehavior::BLOCK_SHUTDOWN},
base::ThreadPool::PostTask(
FROM_HERE, {base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN},
base::BindOnce(&RegisterShortcutsMenuWithOsTask, shortcut_data_dir,
app_id, profile_path, shortcuts));
}
......
......@@ -56,10 +56,9 @@ base::FilePath GetNativeIOFilePath(const base::FilePath& root_path,
scoped_refptr<base::TaskRunner> CreateFileTaskRunner() {
// We use a SequencedTaskRunner so that there is a global ordering to an
// origin's directory operations.
return base::CreateSequencedTaskRunner({
return base::ThreadPool::CreateSequencedTaskRunner({
// Needed for file I/O.
base::MayBlock(),
base::ThreadPool(),
// Reasonable compromise, given that a few database operations are
// blocking, while most operations are not. We should be able to do better
......
......@@ -26,6 +26,7 @@
#include "base/stl_util.h"
#include "base/strings/string16.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/win/object_watcher.h"
......@@ -335,8 +336,8 @@ void UsbDeviceHandleWin::SetInterfaceAlternateSetting(int interface_number,
// Use a strong reference to |this| rather than a weak pointer to prevent
// |interface.handle| from being freed because |this| was destroyed.
base::PostTaskAndReplyWithResult(
FROM_HERE, {base::ThreadPool(), base::MayBlock()},
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock()},
base::BindOnce(&SetCurrentAlternateSettingBlocking,
interface.handle.Get(), alternate_setting),
base::BindOnce(&UsbDeviceHandleWin::OnSetAlternateInterfaceSetting, this,
......@@ -388,8 +389,8 @@ void UsbDeviceHandleWin::ClearHalt(mojom::UsbTransferDirection direction,
// Use a strong reference to |this| rather than a weak pointer to prevent
// |interface.handle| from being freed because |this| was destroyed.
base::PostTaskAndReplyWithResult(
FROM_HERE, {base::ThreadPool(), base::MayBlock()},
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock()},
base::BindOnce(&ResetPipeBlocking, interface.handle.Get(),
endpoint_address),
base::BindOnce(&UsbDeviceHandleWin::OnClearHalt, this,
......
......@@ -21,6 +21,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/lock.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "third_party/skia/include/core/SkBitmap.h"
......@@ -149,9 +150,8 @@ std::string ClipboardMap::Get(const std::string& format) {
}
void ClipboardMap::GetImage(ReadImageCallback callback) {
base::PostTaskAndReplyWithResult(
FROM_HERE,
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_BLOCKING},
base::BindOnce(&GetImageData, clipboard_manager_), std::move(callback));
}
......
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