Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc

Issue 2276353002: Remove after wakeup logic and replace PumpTask with Fences (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Slight simplification Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc b/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc
index 3e025e9dfdea4fcaa3383231290943d3fce5f0f4..20ff3a1116f6628a01002daf48055ed181c184e0 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/throttling_helper.cc
@@ -40,7 +40,7 @@ ThrottlingHelper::~ThrottlingHelper() {
for (const TaskQueueMap::value_type& map_entry : throttled_queues_) {
TaskQueue* task_queue = map_entry.first;
task_queue->SetTimeDomain(renderer_scheduler_->real_time_domain());
- task_queue->SetPumpPolicy(TaskQueue::PumpPolicy::AUTO);
+ task_queue->RemoveFence();
}
renderer_scheduler_->UnregisterTimeDomain(time_domain_.get());
@@ -76,7 +76,7 @@ void ThrottlingHelper::IncreaseThrottleRefCount(TaskQueue* task_queue) {
if (insert_result.second) {
// The insert was succesful so we need to throttle the queue.
task_queue->SetTimeDomain(time_domain_.get());
- task_queue->SetPumpPolicy(TaskQueue::PumpPolicy::MANUAL);
+ task_queue->RemoveFence();
task_queue->SetQueueEnabled(false);
if (!task_queue->IsEmpty()) {
@@ -105,11 +105,15 @@ void ThrottlingHelper::DecreaseThrottleRefCount(TaskQueue* task_queue) {
throttled_queues_.erase(iter);
task_queue->SetTimeDomain(renderer_scheduler_->real_time_domain());
- task_queue->SetPumpPolicy(TaskQueue::PumpPolicy::AUTO);
+ task_queue->RemoveFence();
task_queue->SetQueueEnabled(enabled);
}
}
+bool ThrottlingHelper::IsThrottled(TaskQueue* task_queue) const {
+ return throttled_queues_.find(task_queue) != throttled_queues_.end();
+}
+
void ThrottlingHelper::UnregisterTaskQueue(TaskQueue* task_queue) {
throttled_queues_.erase(task_queue);
}
@@ -145,11 +149,11 @@ void ThrottlingHelper::PumpThrottledTasks() {
LazyNow lazy_low(tick_clock_);
for (const TaskQueueMap::value_type& map_entry : throttled_queues_) {
TaskQueue* task_queue = map_entry.first;
- if (task_queue->IsEmpty())
+ if (!map_entry.second.enabled || task_queue->IsEmpty())
continue;
- task_queue->SetQueueEnabled(map_entry.second.enabled);
- task_queue->PumpQueue(&lazy_low, false);
+ task_queue->SetQueueEnabled(true);
+ task_queue->InsertFence();
}
// Make sure NextScheduledRunTime gives us an up-to date result.
time_domain_->ClearExpiredWakeups();
@@ -212,7 +216,7 @@ void ThrottlingHelper::EnableVirtualTime() {
throttled_queues_.erase(throttled_queues_.begin());
task_queue->SetTimeDomain(renderer_scheduler_->GetVirtualTimeDomain());
- task_queue->SetPumpPolicy(TaskQueue::PumpPolicy::AUTO);
+ task_queue->RemoveFence();
task_queue->SetQueueEnabled(enabled);
}
}

Powered by Google App Engine
This is Rietveld 408576698