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

Migrate off base::ThreadPool()-as-a-trait in /chrome/browser/chromeos/smb_client

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

Bug: 1026641
Change-Id: I020767964acaf25eb38bd90aac0352c8e835ee72
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2079078
Commit-Queue: Gabriel Charette <gab@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarAnand Mistry <amistry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745476}
parent 3a11d6e9
......@@ -13,6 +13,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/posix/eintr_wrapper.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/chromeos/file_system_provider/service.h"
#include "chrome/browser/chromeos/smb_client/smb_errors.h"
#include "chrome/browser/chromeos/smb_client/smb_file_system_id.h"
......@@ -455,14 +456,14 @@ AbortCallback SmbFileSystem::WriteFile(
void SmbFileSystem::CreateTempFileManagerAndExecuteTask(SmbTask task) {
// CreateTempFileManager() has to be called on a separate thread since it
// contains a call that requires a blockable thread.
base::TaskTraits task_traits = {base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_BLOCKING,
constexpr base::TaskTraits kTaskTraits = {
base::MayBlock(), base::TaskPriority::USER_BLOCKING,
base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN};
auto init_task = base::BindOnce(&CreateTempFileManager);
auto reply = base::BindOnce(&SmbFileSystem::InitTempFileManagerAndExecuteTask,
AsWeakPtr(), std::move(task));
base::PostTaskAndReplyWithResult(FROM_HERE, task_traits, std::move(init_task),
std::move(reply));
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, kTaskTraits, std::move(init_task), std::move(reply));
}
void SmbFileSystem::InitTempFileManagerAndExecuteTask(
......
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