Commit d1073dec authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Fences should not be added to new queues when virtual time is disabled

Bug: 791742
Change-Id: Idc2e85972893dddf7ae62eefe5e99859f96e9a14
Reviewed-on: https://chromium-review.googlesource.com/970473
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544671}
parent 85e25f04
......@@ -702,9 +702,13 @@ scoped_refptr<MainThreadTaskQueue> RendererSchedulerImpl::NewTaskQueue(
if (task_queue->CanBeThrottled())
AddQueueToWakeUpBudgetPool(task_queue.get());
if (queue_class == MainThreadTaskQueue::QueueClass::kTimer) {
if (main_thread_only().virtual_time_stopped)
task_queue->InsertFence(TaskQueue::InsertFencePosition::kNow);
// If this is a timer queue, and virtual time is enabled and paused, it should
// be suspended by adding a fence to prevent immediate tasks from running when
// they're not supposed to.
if (queue_class == MainThreadTaskQueue::QueueClass::kTimer &&
main_thread_only().virtual_time_stopped &&
main_thread_only().use_virtual_time) {
task_queue->InsertFence(TaskQueue::InsertFencePosition::kNow);
}
return task_queue;
......
......@@ -3729,6 +3729,15 @@ TEST_F(RendererSchedulerImplTest, UnthrottledTaskRunner) {
EXPECT_EQ(500u, unthrottled_count);
}
TEST_F(RendererSchedulerImplTest,
VirtualTimePolicyDoesNotAffectNewTimerTaskQueueIfVirtualTimeNotEnabled) {
scheduler_->SetVirtualTimePolicy(
PageSchedulerImpl::VirtualTimePolicy::kPause);
scoped_refptr<MainThreadTaskQueue> timer_tq = scheduler_->NewTimerTaskQueue(
MainThreadTaskQueue::QueueType::kFrameThrottleable);
EXPECT_FALSE(timer_tq->HasActiveFence());
}
TEST_F(RendererSchedulerImplTest, EnableVirtualTime) {
EXPECT_FALSE(scheduler_->IsVirtualTimeEnabled());
scheduler_->EnableVirtualTime(
......
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