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

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

Issue 2725633002: scheduler: Suspend timers while virtual time is paused (Closed)
Patch Set: Rebased Created 3 years, 9 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/renderer_scheduler_impl.cc
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
index d9415752fc98bb48918f9e70d29226d9d38da931..509b289113297bf853cb7faf50c16645809fbefd 100644
--- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
+++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_scheduler_impl.cc
@@ -1204,14 +1204,18 @@ void RendererSchedulerImpl::ApplyTaskQueuePolicy(
if (old_task_queue_policy.time_domain_type !=
new_task_queue_policy.time_domain_type) {
if (old_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) {
+ task_queue->SetTimeDomain(real_time_domain());
task_queue_throttler_->DecreaseThrottleRefCount(task_queue);
} else if (new_task_queue_policy.time_domain_type ==
TimeDomainType::THROTTLED) {
+ task_queue->SetTimeDomain(real_time_domain());
task_queue_throttler_->IncreaseThrottleRefCount(task_queue);
} else if (new_task_queue_policy.time_domain_type ==
TimeDomainType::VIRTUAL) {
DCHECK(virtual_time_domain_);
task_queue->SetTimeDomain(virtual_time_domain_.get());
+ } else {
+ task_queue->SetTimeDomain(real_time_domain());
}
}
}
@@ -1822,6 +1826,17 @@ void RendererSchedulerImpl::EnableVirtualTime() {
ForceUpdatePolicy();
}
+void RendererSchedulerImpl::DisableVirtualTimeForTesting() {
+ MainThreadOnly().use_virtual_time = false;
+
+ RealTimeDomain* time_domain = real_time_domain();
+ // The |unthrottled_task_runners_| are not actively managed by UpdatePolicy().
+ for (const scoped_refptr<TaskQueue>& task_queue : unthrottled_task_runners_)
+ task_queue->SetTimeDomain(time_domain);
+
+ ForceUpdatePolicy();
+}
+
bool RendererSchedulerImpl::ShouldDisableThrottlingBecauseOfAudio(
base::TimeTicks now) {
if (!MainThreadOnly().last_audio_state_change)

Powered by Google App Engine
This is Rietveld 408576698