Commit 879b222e authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

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

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

Bug: 1026641
Change-Id: Ia186179ca831edf161da9a31a249e175444bca41
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078665Reviewed-by: default avatarJeffrey Kardatzke <jkardatzke@google.com>
Reviewed-by: default avatarJ Kardatzke <jkardatzke@chromium.org>
Commit-Queue: J Kardatzke <jkardatzke@chromium.org>
Auto-Submit: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745680}
parent 1d95553c
......@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"
......@@ -46,10 +47,8 @@ void IwlwifiDumpChecker::Fetch(SysLogsSourceCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!callback.is_null());
base::PostTaskAndReplyWithResult(
FROM_HERE,
base::TaskTraits({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT}),
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&CheckExistenceOnBlockingTaskRunner),
base::BindOnce(std::move(callback)));
}
......@@ -63,10 +62,8 @@ void IwlwifiDumpLogSource::Fetch(SysLogsSourceCallback callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!callback.is_null());
base::PostTaskAndReplyWithResult(
FROM_HERE,
base::TaskTraits({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT}),
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&ReadDumpOnBlockingTaskRunner),
base::BindOnce(std::move(callback)));
}
......
......@@ -10,6 +10,7 @@
#include "base/process/process_info.h"
#include "base/strings/string_split.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "base/time/time.h"
#include "content/public/browser/browser_thread.h"
......@@ -98,10 +99,8 @@ void SingleLogFileLogSource::Fetch(SysLogsSourceCallback callback) {
auto response = std::make_unique<SystemLogsResponse>();
auto* response_ptr = response.get();
base::PostTaskAndReply(
FROM_HERE,
base::TaskTraits({base::ThreadPool(), base::MayBlock(),
base::TaskPriority::BEST_EFFORT}),
base::ThreadPool::PostTaskAndReply(
FROM_HERE, {base::MayBlock(), base::TaskPriority::BEST_EFFORT},
base::BindOnce(&SingleLogFileLogSource::ReadFile,
weak_ptr_factory_.GetWeakPtr(),
kMaxNumAllowedLogRotationsDuringFileRead, response_ptr),
......
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