refactor: migrate base::ThreadPool() as trait to base::ThreadPool:: API (#22555)
This commit is contained in:
parent
2159b4af4f
commit
3b08736ae2
8 changed files with 24 additions and 24 deletions
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/thread_restrictions.h"
|
||||
#include "content/public/browser/tracing_controller.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
|
@ -86,10 +87,8 @@ v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) {
|
|||
StopTracing(std::move(promise), base::make_optional(path));
|
||||
} else {
|
||||
// use a temporary file.
|
||||
base::PostTaskAndReplyWithResult(
|
||||
FROM_HERE,
|
||||
{base::ThreadPool(), base::MayBlock(),
|
||||
base::TaskPriority::USER_VISIBLE},
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE, {base::MayBlock(), base::TaskPriority::USER_VISIBLE},
|
||||
base::BindOnce(CreateTemporaryFileOnIO),
|
||||
base::BindOnce(StopTracing, std::move(promise)));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <utility>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "chrome/browser/browser_process.h"
|
||||
#include "components/net_log/chrome_net_log.h"
|
||||
#include "content/public/browser/storage_partition.h"
|
||||
|
@ -52,8 +53,8 @@ scoped_refptr<base::SequencedTaskRunner> CreateFileTaskRunner() {
|
|||
//
|
||||
// These operations can be skipped on shutdown since FileNetLogObserver's API
|
||||
// doesn't require things to have completed until notified of completion.
|
||||
return base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
return base::ThreadPool::CreateSequencedTaskRunner(
|
||||
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
|
||||
}
|
||||
|
||||
|
|
|
@ -1949,9 +1949,8 @@ void WebContents::Print(gin_helper::Arguments* args) {
|
|||
settings.SetIntKey(printing::kSettingDpiVertical, dpi);
|
||||
}
|
||||
|
||||
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(&GetDefaultPrinterAsync),
|
||||
base::BindOnce(&WebContents::OnGetDefaultPrinter,
|
||||
weak_factory_.GetWeakPtr(), std::move(settings),
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "base/files/file_util.h"
|
||||
#include "base/json/json_reader.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 "chrome/browser/ssl/security_state_tab_helper.h"
|
||||
|
@ -183,8 +184,8 @@ bool IsDevToolsFileSystemAdded(content::WebContents* web_contents,
|
|||
|
||||
CommonWebContentsDelegate::CommonWebContentsDelegate()
|
||||
: devtools_file_system_indexer_(new DevToolsFileSystemIndexer),
|
||||
file_task_runner_(base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock()})),
|
||||
file_task_runner_(
|
||||
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()})),
|
||||
weak_factory_(this) {}
|
||||
|
||||
CommonWebContentsDelegate::~CommonWebContentsDelegate() = default;
|
||||
|
|
|
@ -226,9 +226,9 @@ bool ElectronDownloadManagerDelegate::DetermineDownloadTarget(
|
|||
base::FilePath default_download_path =
|
||||
browser_context->prefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
|
||||
|
||||
base::PostTaskAndReplyWithResult(
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
FROM_HERE,
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::BEST_EFFORT,
|
||||
{base::MayBlock(), base::TaskPriority::BEST_EFFORT,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
|
||||
base::BindOnce(&CreateDownloadPath, download->GetURL(),
|
||||
download->GetContentDisposition(),
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "content/public/browser/file_url_loader.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "mojo/public/cpp/bindings/remote.h"
|
||||
|
@ -304,8 +305,8 @@ void CreateAsarURLLoader(
|
|||
network::mojom::URLLoaderRequest loader,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderClient> client,
|
||||
scoped_refptr<net::HttpResponseHeaders> extra_response_headers) {
|
||||
auto task_runner = base::CreateSequencedTaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
auto task_runner = base::ThreadPool::CreateSequencedTaskRunner(
|
||||
{base::MayBlock(), base::TaskPriority::USER_VISIBLE,
|
||||
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN});
|
||||
task_runner->PostTask(
|
||||
FROM_HERE,
|
||||
|
|
|
@ -131,10 +131,8 @@ int ViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor,
|
|||
if (monitor && !in_autohide_edges_callback_) {
|
||||
// TODO(robliao): Annotate this task with .WithCOM() once supported.
|
||||
// https://crbug.com/662122
|
||||
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(&GetAppbarAutohideEdgesOnWorkerThread, monitor),
|
||||
base::BindOnce(&ViewsDelegate::OnGotAppbarAutohideEdges,
|
||||
weak_factory_.GetWeakPtr(), std::move(callback), monitor,
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "base/task/thread_pool.h"
|
||||
#include "base/threading/scoped_blocking_call.h"
|
||||
#include "base/win/registry.h"
|
||||
#include "base/win/scoped_co_mem.h"
|
||||
|
@ -317,8 +318,8 @@ std::string OpenPathOnThread(const base::FilePath& full_path) {
|
|||
namespace platform_util {
|
||||
|
||||
void ShowItemInFolder(const base::FilePath& full_path) {
|
||||
base::CreateCOMSTATaskRunner(
|
||||
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_BLOCKING})
|
||||
base::ThreadPool::CreateSingleThreadTaskRunner(
|
||||
{base::MayBlock(), base::TaskPriority::USER_BLOCKING})
|
||||
->PostTask(FROM_HERE,
|
||||
base::BindOnce(&ShowItemInFolderOnWorkerThread, full_path));
|
||||
}
|
||||
|
@ -327,7 +328,7 @@ void OpenPath(const base::FilePath& full_path, OpenCallback callback) {
|
|||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
base::PostTaskAndReplyWithResult(
|
||||
base::CreateCOMSTATaskRunner({base::ThreadPool(), base::MayBlock(),
|
||||
base::ThreadPool::CreateSingleThreadTaskRunner(({base::MayBlock(),
|
||||
base::TaskPriority::USER_BLOCKING})
|
||||
.get(),
|
||||
FROM_HERE, base::BindOnce(&OpenPathOnThread, full_path),
|
||||
|
@ -338,8 +339,8 @@ void OpenExternal(const GURL& url,
|
|||
const OpenExternalOptions& options,
|
||||
OpenCallback callback) {
|
||||
base::PostTaskAndReplyWithResult(
|
||||
base::CreateCOMSTATaskRunner({base::ThreadPool(), base::MayBlock(),
|
||||
base::TaskPriority::USER_BLOCKING})
|
||||
base::ThreadPool::CreateCOMSTATaskRunner(
|
||||
{base::MayBlock(), base::TaskPriority::USER_BLOCKING})
|
||||
.get(),
|
||||
FROM_HERE, base::BindOnce(&OpenExternalOnWorkerThread, url, options),
|
||||
std::move(callback));
|
||||
|
|
Loading…
Reference in a new issue