Commit 46a95b5e authored by Yuta Kitamura's avatar Yuta Kitamura Committed by Commit Bot

Remove WebTaskRunner::PostDelayedTask() for CrossThreadClosure.

This patch removes WebTaskRunner::PostDelayedTask() for CrossThread-
Closure. New code must use a new namespace-level PostDelayedCrossThread-
Task() instead. These are functionally identical.

This patch also converts all the existing usage. Since the number of the
use sites is small, it's convenient to do migration and removal together.

Bug: 794845
Change-Id: I8c9deafe1e6fbc6c23c9d38864b97d9396e72320
Reviewed-on: https://chromium-review.googlesource.com/842962Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Commit-Queue: Yuta Kitamura <yutak@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526002}
parent a6a203c9
......@@ -112,12 +112,6 @@ TaskHandle::TaskHandle(scoped_refptr<Runner> runner)
DCHECK(runner_);
}
void WebTaskRunner::PostDelayedTask(const base::Location& location,
CrossThreadClosure task,
TimeDelta delay) {
PostDelayedCrossThreadTask(*this, location, std::move(task), delay);
}
void WebTaskRunner::PostTask(const base::Location& location,
base::OnceClosure task) {
PostDelayedTask(location, std::move(task), base::TimeDelta());
......
......@@ -70,12 +70,6 @@ class BLINK_PLATFORM_EXPORT WebTaskRunner
// Helpers for posting bound functions as tasks.
// Deprecated. Use namespace-level Post(Delayed)CrossThreadTask() defined
// below.
void PostDelayedTask(const base::Location&,
CrossThreadClosure,
TimeDelta delay);
// For same-thread posting. Must be called from the associated WebThread.
void PostTask(const base::Location&, base::OnceClosure);
......
......@@ -53,8 +53,8 @@ class PLATFORM_EXPORT WebThreadSupportingGC final {
void PostDelayedTask(const base::Location& location,
CrossThreadClosure task,
TimeDelta delay) {
thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task),
delay);
PostDelayedCrossThreadTask(*thread_->GetWebTaskRunner(), location,
std::move(task), delay);
}
bool IsCurrentThread() const { return thread_->IsCurrentThread(); }
......
......@@ -57,8 +57,8 @@ class FIFOClient {
++counter_;
RunTask();
if (elapsed_ms_ < duration_ms_) {
client_thread_->GetWebTaskRunner()->PostDelayedTask(
FROM_HERE,
PostDelayedCrossThreadTask(
*client_thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&FIFOClient::RunTaskOnOwnThread,
CrossThreadUnretained(this)),
TimeDelta::FromMillisecondsD(interval_with_jitter));
......
......@@ -151,8 +151,9 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestIdleTask) {
thread_->PostIdleTask(
FROM_HERE, base::BindOnce(&MockIdleTask::Run, WTF::Unretained(&task)));
// We need to post a wake-up task or idle work will never happen.
thread_->GetWebTaskRunner()->PostDelayedTask(
FROM_HERE, CrossThreadBind([] {}), TimeDelta::FromMilliseconds(50));
PostDelayedCrossThreadTask(*thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind([] {}),
TimeDelta::FromMilliseconds(50));
completion.Wait();
}
......@@ -189,8 +190,8 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestShutdown) {
PostCrossThreadTask(
*thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&MockTask::Run, WTF::CrossThreadUnretained(&task)));
thread_->GetWebTaskRunner()->PostDelayedTask(
FROM_HERE,
PostDelayedCrossThreadTask(
*thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&MockTask::Run,
WTF::CrossThreadUnretained(&delayed_task)),
TimeDelta::FromMilliseconds(50));
......
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