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

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: scheduler: Suspend timers while virtual time is paused 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..be6898d25bdadedb225aeae2b2da81e6f1e1ccb2 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
@@ -1203,6 +1203,9 @@ 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::VIRTUAL)
+ task_queue->SetTimeDomain(real_time_domain());
alex clarke (OOO till 29th) 2017/03/09 11:11:33 Setting this redundantly is cheap. Maybe just mov
Sami 2017/03/09 11:25:33 Done. (FWIW setting this takes a lock, but I think
+
if (old_task_queue_policy.time_domain_type == TimeDomainType::THROTTLED) {
task_queue_throttler_->DecreaseThrottleRefCount(task_queue);
} else if (new_task_queue_policy.time_domain_type ==
@@ -1822,6 +1825,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