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) ...@@ -112,12 +112,6 @@ TaskHandle::TaskHandle(scoped_refptr<Runner> runner)
DCHECK(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, void WebTaskRunner::PostTask(const base::Location& location,
base::OnceClosure task) { base::OnceClosure task) {
PostDelayedTask(location, std::move(task), base::TimeDelta()); PostDelayedTask(location, std::move(task), base::TimeDelta());
......
...@@ -70,12 +70,6 @@ class BLINK_PLATFORM_EXPORT WebTaskRunner ...@@ -70,12 +70,6 @@ class BLINK_PLATFORM_EXPORT WebTaskRunner
// Helpers for posting bound functions as tasks. // 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. // For same-thread posting. Must be called from the associated WebThread.
void PostTask(const base::Location&, base::OnceClosure); void PostTask(const base::Location&, base::OnceClosure);
......
...@@ -53,8 +53,8 @@ class PLATFORM_EXPORT WebThreadSupportingGC final { ...@@ -53,8 +53,8 @@ class PLATFORM_EXPORT WebThreadSupportingGC final {
void PostDelayedTask(const base::Location& location, void PostDelayedTask(const base::Location& location,
CrossThreadClosure task, CrossThreadClosure task,
TimeDelta delay) { TimeDelta delay) {
thread_->GetWebTaskRunner()->PostDelayedTask(location, std::move(task), PostDelayedCrossThreadTask(*thread_->GetWebTaskRunner(), location,
delay); std::move(task), delay);
} }
bool IsCurrentThread() const { return thread_->IsCurrentThread(); } bool IsCurrentThread() const { return thread_->IsCurrentThread(); }
......
...@@ -57,8 +57,8 @@ class FIFOClient { ...@@ -57,8 +57,8 @@ class FIFOClient {
++counter_; ++counter_;
RunTask(); RunTask();
if (elapsed_ms_ < duration_ms_) { if (elapsed_ms_ < duration_ms_) {
client_thread_->GetWebTaskRunner()->PostDelayedTask( PostDelayedCrossThreadTask(
FROM_HERE, *client_thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&FIFOClient::RunTaskOnOwnThread, CrossThreadBind(&FIFOClient::RunTaskOnOwnThread,
CrossThreadUnretained(this)), CrossThreadUnretained(this)),
TimeDelta::FromMillisecondsD(interval_with_jitter)); TimeDelta::FromMillisecondsD(interval_with_jitter));
......
...@@ -151,8 +151,9 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestIdleTask) { ...@@ -151,8 +151,9 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestIdleTask) {
thread_->PostIdleTask( thread_->PostIdleTask(
FROM_HERE, base::BindOnce(&MockIdleTask::Run, WTF::Unretained(&task))); FROM_HERE, base::BindOnce(&MockIdleTask::Run, WTF::Unretained(&task)));
// We need to post a wake-up task or idle work will never happen. // We need to post a wake-up task or idle work will never happen.
thread_->GetWebTaskRunner()->PostDelayedTask( PostDelayedCrossThreadTask(*thread_->GetWebTaskRunner(), FROM_HERE,
FROM_HERE, CrossThreadBind([] {}), TimeDelta::FromMilliseconds(50)); CrossThreadBind([] {}),
TimeDelta::FromMilliseconds(50));
completion.Wait(); completion.Wait();
} }
...@@ -189,8 +190,8 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestShutdown) { ...@@ -189,8 +190,8 @@ TEST_F(WebThreadImplForWorkerSchedulerTest, TestShutdown) {
PostCrossThreadTask( PostCrossThreadTask(
*thread_->GetWebTaskRunner(), FROM_HERE, *thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&MockTask::Run, WTF::CrossThreadUnretained(&task))); CrossThreadBind(&MockTask::Run, WTF::CrossThreadUnretained(&task)));
thread_->GetWebTaskRunner()->PostDelayedTask( PostDelayedCrossThreadTask(
FROM_HERE, *thread_->GetWebTaskRunner(), FROM_HERE,
CrossThreadBind(&MockTask::Run, CrossThreadBind(&MockTask::Run,
WTF::CrossThreadUnretained(&delayed_task)), WTF::CrossThreadUnretained(&delayed_task)),
TimeDelta::FromMilliseconds(50)); 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