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

[blink] Migrate worker_pool:: interface away from base::ThreadPool()-as-a-trait

base::ThreadPool:: (API as a destination) is the new desired paradigm.

worker_pool:: was already API-as-destination; can remove redundant
ThreadPool() trait with new API.

R=haraken@chromium.org

Bug: 1026641
Change-Id: Ida08feab710143da2308ef1361550a9aced39d2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2105454
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750565}
parent 60050bad
......@@ -501,8 +501,7 @@ bool ScriptStreamer::TryStartStreaming(
// they wait for more input.
// TODO(leszeks): Decrease the priority of these tasks where possible.
worker_pool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::USER_BLOCKING, base::MayBlock()},
FROM_HERE, {base::TaskPriority::USER_BLOCKING, base::MayBlock()},
CrossThreadBindOnce(RunScriptStreamingTask,
WTF::Passed(std::move(script_streaming_task)),
WrapCrossThreadPersistent(this),
......
......@@ -368,8 +368,7 @@ void MediaStreamAudioProcessor::OnStartDump(base::File dump_file) {
} else {
// Post the file close to avoid blocking the main thread.
worker_pool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::LOWEST, base::MayBlock()},
FROM_HERE, {base::TaskPriority::LOWEST, base::MayBlock()},
CrossThreadBindOnce([](base::File) {}, std::move(dump_file)));
}
}
......
......@@ -62,8 +62,7 @@ void AudioServiceAudioProcessorProxy::OnStartDump(base::File dump_file) {
} else {
// Post the file close to avoid blocking the main thread.
worker_pool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::LOWEST, base::MayBlock()},
FROM_HERE, {base::TaskPriority::LOWEST, base::MayBlock()},
CrossThreadBindOnce([](base::File) {}, std::move(dump_file)));
}
}
......
......@@ -5,23 +5,21 @@
#include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h"
#include "base/location.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
namespace blink {
namespace worker_pool {
void PostTask(const base::Location& location, CrossThreadOnceClosure closure) {
PostTask(
location,
{base::ThreadPool(), base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
PostTask(location, {base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
std::move(closure));
}
void PostTask(const base::Location& location,
const base::TaskTraits& traits,
CrossThreadOnceClosure closure) {
base::PostTask(location, traits,
base::ThreadPool::PostTask(location, traits,
ConvertToBaseOnceCallback(std::move(closure)));
}
......
......@@ -15,9 +15,9 @@ namespace blink {
namespace worker_pool {
// These are a thin wrapper around base::ThreadPoolInstance to ensure that all
// callers use CrossThreadBindOnce instead of base::Bind to ensure that
// all non-thread-safe objects are copied properly.
// These are a thin wrapper around base::ThreadPool to ensure that all callers
// use CrossThreadBindOnce instead of base::Bind to ensure that all
// non-thread-safe objects are copied properly.
//
// All tasks that do not care about which thread they are running on
// (e.g. compressing/uncompressing tasks) use this API.
......
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