Commit 1ef8699c authored by Imranur Rahman's avatar Imranur Rahman Committed by Commit Bot

Renaming all the instances of ShouldUseVirtualTime for the virtual time queue

trait to CanRunWhenVirtualTimePaused.

Renaming the virtual time queue trait should make it more clear and
precise. Also, renaming should_use_virtual_time to
can_run_when_virtual_time_paused.

Bug=988403
Signed-off-by: default avatarImranur Rahman <ir.shimul@gmail.com>
Change-Id: I378b2906a42fb77d5efe5d3b527375efa9f75fe4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1792031Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Commit-Queue: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696058}
parent 425ce839
......@@ -1147,7 +1147,7 @@ FrameSchedulerImpl::ThrottleableTaskQueueTraits() {
.SetCanBeFrozen(true)
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true);
.SetCanRunWhenVirtualTimePaused(true);
}
// static
......@@ -1158,7 +1158,7 @@ FrameSchedulerImpl::DeferrableTaskQueueTraits() {
.SetCanBeFrozen(base::FeatureList::IsEnabled(
blink::features::kStopNonTimersInBackground))
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true);
.SetCanRunWhenVirtualTimePaused(true);
}
// static
......@@ -1168,7 +1168,7 @@ FrameSchedulerImpl::PausableTaskQueueTraits() {
.SetCanBeFrozen(base::FeatureList::IsEnabled(
blink::features::kStopNonTimersInBackground))
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true);
.SetCanRunWhenVirtualTimePaused(true);
}
// static
......@@ -1182,19 +1182,19 @@ FrameSchedulerImpl::FreezableTaskQueueTraits() {
// static
MainThreadTaskQueue::QueueTraits
FrameSchedulerImpl::UnpausableTaskQueueTraits() {
return QueueTraits().SetShouldUseVirtualTime(true);
return QueueTraits().SetCanRunWhenVirtualTimePaused(true);
}
MainThreadTaskQueue::QueueTraits
FrameSchedulerImpl::ForegroundOnlyTaskQueueTraits() {
return ThrottleableTaskQueueTraits()
.SetCanRunInBackground(false)
.SetShouldUseVirtualTime(true);
.SetCanRunWhenVirtualTimePaused(true);
}
MainThreadTaskQueue::QueueTraits
FrameSchedulerImpl::DoesNotUseVirtualTimeTaskQueueTraits() {
return QueueTraits().SetShouldUseVirtualTime(false);
return QueueTraits().SetCanRunWhenVirtualTimePaused(false);
}
void FrameSchedulerImpl::SetPausedForCooperativeScheduling(Paused paused) {
......
......@@ -1792,37 +1792,37 @@ TEST_F(ThrottleableAndFreezableTaskTypesTest, QueueTraitsFromFieldTrialParams) {
.SetCanBeThrottled(true)
.SetCanBeFrozen(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kMediaElementEvent);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeFrozen(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kDatabaseAccess);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kDOMManipulation);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeFrozen(true)
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
// Test some task types that were not configured through field trial
// parameters.
task_queue = GetTaskQueue(TaskType::kInternalIPC);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kMiscPlatformAPI);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
}
......@@ -1900,35 +1900,35 @@ TEST_F(ThrottleableOnlyTaskTypesTest, QueueTraitsFromFieldTrialParams) {
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeThrottled(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kMediaElementEvent);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kDatabaseAccess);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kDOMManipulation);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
// Test some task types that were not configured through field trial
// parameters.
task_queue = GetTaskQueue(TaskType::kInternalIPC);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
task_queue = GetTaskQueue(TaskType::kMiscPlatformAPI);
EXPECT_EQ(task_queue->GetQueueTraits(), MainThreadTaskQueue::QueueTraits()
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
}
class FrameSchedulerImplDatabaseAccessWithoutHighPriority
......
......@@ -95,7 +95,7 @@ class FrameTaskQueueControllerTest : public testing::Test,
.SetCanBeFrozen(true)
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
}
scoped_refptr<MainThreadTaskQueue> GetTaskQueue(
......@@ -144,7 +144,7 @@ TEST_F(FrameTaskQueueControllerTest, CreateAllTaskQueues) {
.SetCanBeDeferred(true)
.SetCanBeFrozen(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
EXPECT_FALSE(all_task_queues.Contains(task_queue));
all_task_queues.insert(task_queue.get(), QueueCheckResult::kDidNotSeeQueue);
EXPECT_EQ(all_task_queues.size(), task_queue_created_count());
......@@ -152,20 +152,20 @@ TEST_F(FrameTaskQueueControllerTest, CreateAllTaskQueues) {
task_queue = GetTaskQueue(QueueTraits()
.SetCanBeDeferred(true)
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
EXPECT_FALSE(all_task_queues.Contains(task_queue));
all_task_queues.insert(task_queue.get(), QueueCheckResult::kDidNotSeeQueue);
EXPECT_EQ(all_task_queues.size(), task_queue_created_count());
task_queue = GetTaskQueue(QueueTraits()
.SetCanBePaused(true)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
EXPECT_FALSE(all_task_queues.Contains(task_queue));
all_task_queues.insert(task_queue.get(), QueueCheckResult::kDidNotSeeQueue);
EXPECT_EQ(all_task_queues.size(), task_queue_created_count());
task_queue = GetTaskQueue(QueueTraits()
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
EXPECT_FALSE(all_task_queues.Contains(task_queue));
all_task_queues.insert(task_queue.get(), QueueCheckResult::kDidNotSeeQueue);
EXPECT_EQ(all_task_queues.size(), task_queue_created_count());
......@@ -368,7 +368,7 @@ TEST_P(TaskQueueCreationFromQueueTraitsTest,
.SetCanBeFrozen(!!(i & 1 << 2))
.SetCanBePaused(!!(i & 1 << 3))
.SetCanRunInBackground(!!(i & 1 << 4))
.SetShouldUseVirtualTime(!!(i & 1 << 5))
.SetCanRunWhenVirtualTimePaused(!!(i & 1 << 5))
.SetPrioritisationType(prioritisation_type);
scoped_refptr<MainThreadTaskQueue> task_queue =
frame_task_queue_controller_->GetTaskQueue(queue_traits);
......
......@@ -786,7 +786,7 @@ scoped_refptr<MainThreadTaskQueue> MainThreadSchedulerImpl::NewTimerTaskQueue(
.SetCanBeDeferred(true)
.SetCanBeThrottled(true)
.SetFrameScheduler(frame_scheduler)
.SetShouldUseVirtualTime(true));
.SetCanRunWhenVirtualTimePaused(true));
}
std::unique_ptr<WebRenderWidgetSchedulingState>
......
......@@ -3239,7 +3239,7 @@ TEST_P(MainThreadSchedulerImplTest, VirtualTimeWithOneQueueWithoutVirtualTime) {
task_queues.push_back(scheduler_->NewTaskQueue(
MainThreadTaskQueue::QueueCreationParams(
MainThreadTaskQueue::QueueType::kFrameThrottleable)
.SetShouldUseVirtualTime(i != 42)));
.SetCanRunWhenVirtualTimePaused(i != 42)));
}
// This should install a fence on all queues with virtual time.
......
......@@ -118,7 +118,7 @@ class PLATFORM_EXPORT MainThreadTaskQueue
can_be_paused(false),
can_be_frozen(false),
can_run_in_background(true),
should_use_virtual_time(false) {}
can_run_when_virtual_time_paused(false) {}
// Separate enum class for handling prioritisation decisions in task queues.
enum class PrioritisationType {
......@@ -170,8 +170,8 @@ class PLATFORM_EXPORT MainThreadTaskQueue
return *this;
}
QueueTraits SetShouldUseVirtualTime(bool value) {
should_use_virtual_time = value;
QueueTraits SetCanRunWhenVirtualTimePaused(bool value) {
can_run_when_virtual_time_paused = value;
return *this;
}
......@@ -186,7 +186,7 @@ class PLATFORM_EXPORT MainThreadTaskQueue
can_be_paused == other.can_be_paused &&
can_be_frozen == other.can_be_frozen &&
can_run_in_background == other.can_run_in_background &&
should_use_virtual_time == other.should_use_virtual_time &&
can_run_when_virtual_time_paused == other.can_run_when_virtual_time_paused &&
prioritisation_type == other.prioritisation_type;
}
......@@ -201,7 +201,7 @@ class PLATFORM_EXPORT MainThreadTaskQueue
key |= can_be_paused << (offset++);
key |= can_be_frozen << (offset++);
key |= can_run_in_background << (offset++);
key |= should_use_virtual_time << (offset++);
key |= can_run_when_virtual_time_paused << (offset++);
key |= static_cast<int>(prioritisation_type) << offset;
offset += kPrioritisationTypeWidthBits;
return key;
......@@ -212,7 +212,7 @@ class PLATFORM_EXPORT MainThreadTaskQueue
bool can_be_paused : 1;
bool can_be_frozen : 1;
bool can_run_in_background : 1;
bool should_use_virtual_time : 1;
bool can_run_when_virtual_time_paused : 1;
PrioritisationType prioritisation_type = PrioritisationType::kRegular;
};
......@@ -273,8 +273,8 @@ class PLATFORM_EXPORT MainThreadTaskQueue
return *this;
}
QueueCreationParams SetShouldUseVirtualTime(bool value) {
queue_traits = queue_traits.SetShouldUseVirtualTime(value);
QueueCreationParams SetCanRunWhenVirtualTimePaused(bool value) {
queue_traits = queue_traits.SetCanRunWhenVirtualTimePaused(value);
ApplyQueueTraitsToSpec();
return *this;
}
......@@ -346,7 +346,7 @@ class PLATFORM_EXPORT MainThreadTaskQueue
}
bool ShouldUseVirtualTime() const {
return queue_traits_.should_use_virtual_time;
return queue_traits_.can_run_when_virtual_time_paused;
}
bool FreezeWhenKeepActive() const { return freeze_when_keep_active_; }
......
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