Commit 3335456d authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Fix misuses of PostCrossThreadTask

Some users of PostCrossThreadTask end up posting a task to the
same thread, which is not the purpose of this Blink primitive.

This CL fixes it. No new behavior is expected.

BUG=None

Change-Id: Idf3157749308f023174375172b204fff667d45b5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610317
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659091}
parent 97b3131d
...@@ -522,10 +522,9 @@ TEST_F(InteractiveDetectorTest, TaskLongerThan5sBlocksTTI) { ...@@ -522,10 +522,9 @@ TEST_F(InteractiveDetectorTest, TaskLongerThan5sBlocksTTI) {
t0 + TimeDelta::FromSeconds(4)); t0 + TimeDelta::FromSeconds(4));
// Post a task with 6 seconds duration. // Post a task with 6 seconds duration.
PostCrossThreadTask( Thread::Current()->GetTaskRunner()->PostTask(
*Thread::Current()->GetTaskRunner(), FROM_HERE, FROM_HERE, WTF::Bind(&InteractiveDetectorTest::DummyTaskWithDuration,
CrossThreadBind(&InteractiveDetectorTest::DummyTaskWithDuration, WTF::Unretained(this), 6.0));
CrossThreadUnretained(this), 6.0));
platform_->RunUntilIdle(); platform_->RunUntilIdle();
...@@ -543,10 +542,9 @@ TEST_F(InteractiveDetectorTest, LongTaskAfterTTIDoesNothing) { ...@@ -543,10 +542,9 @@ TEST_F(InteractiveDetectorTest, LongTaskAfterTTIDoesNothing) {
t0 + TimeDelta::FromSeconds(4)); t0 + TimeDelta::FromSeconds(4));
// Long task 1. // Long task 1.
PostCrossThreadTask( Thread::Current()->GetTaskRunner()->PostTask(
*Thread::Current()->GetTaskRunner(), FROM_HERE, FROM_HERE, WTF::Bind(&InteractiveDetectorTest::DummyTaskWithDuration,
CrossThreadBind(&InteractiveDetectorTest::DummyTaskWithDuration, WTF::Unretained(this), 0.1));
CrossThreadUnretained(this), 0.1));
platform_->RunUntilIdle(); platform_->RunUntilIdle();
...@@ -556,10 +554,9 @@ TEST_F(InteractiveDetectorTest, LongTaskAfterTTIDoesNothing) { ...@@ -556,10 +554,9 @@ TEST_F(InteractiveDetectorTest, LongTaskAfterTTIDoesNothing) {
EXPECT_EQ(GetDetector()->GetInteractiveTime(), long_task_1_end_time); EXPECT_EQ(GetDetector()->GetInteractiveTime(), long_task_1_end_time);
// Long task 2. // Long task 2.
PostCrossThreadTask( Thread::Current()->GetTaskRunner()->PostTask(
*Thread::Current()->GetTaskRunner(), FROM_HERE, FROM_HERE, WTF::Bind(&InteractiveDetectorTest::DummyTaskWithDuration,
CrossThreadBind(&InteractiveDetectorTest::DummyTaskWithDuration, WTF::Unretained(this), 0.1));
CrossThreadUnretained(this), 0.1));
platform_->RunUntilIdle(); platform_->RunUntilIdle();
// Wait 5 seconds to see if TTI time changes. // Wait 5 seconds to see if TTI time changes.
......
...@@ -53,10 +53,9 @@ class LongTaskDetectorTest : public testing::Test { ...@@ -53,10 +53,9 @@ class LongTaskDetectorTest : public testing::Test {
TimeTicks DummyTaskEndTime() { return dummy_task_end_time_; } TimeTicks DummyTaskEndTime() { return dummy_task_end_time_; }
void SimulateTask(base::TimeDelta duration) { void SimulateTask(base::TimeDelta duration) {
PostCrossThreadTask( Thread::Current()->GetTaskRunner()->PostTask(
*Thread::Current()->GetTaskRunner(), FROM_HERE, FROM_HERE, WTF::Bind(&LongTaskDetectorTest::DummyTaskWithDuration,
CrossThreadBind(&LongTaskDetectorTest::DummyTaskWithDuration, WTF::Unretained(this), duration));
CrossThreadUnretained(this), duration));
platform_->RunUntilIdle(); platform_->RunUntilIdle();
} }
......
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