Index: components/scheduler/renderer/renderer_scheduler_impl.cc |
diff --git a/components/scheduler/renderer/renderer_scheduler_impl.cc b/components/scheduler/renderer/renderer_scheduler_impl.cc |
index 5eb73a0de3a886ce5c763138e977d1e3a79e28c5..d86450f97f8f4621f5f79aacbd51c1486acb9daf 100644 |
--- a/components/scheduler/renderer/renderer_scheduler_impl.cc |
+++ b/components/scheduler/renderer/renderer_scheduler_impl.cc |
@@ -387,6 +387,17 @@ void RendererSchedulerImpl::OnRendererForegrounded() { |
ResumeTimerQueueWhenForegrounded(); |
} |
+void RendererSchedulerImpl::SuspendRenderer() { |
+ helper_.CheckOnValidThread(); |
+ DCHECK(MainThreadOnly().renderer_backgrounded); |
+ if (helper_.IsShutdown()) |
+ return; |
+ suspend_timers_when_backgrounded_closure_.Cancel(); |
+ // TODO(hajimehoshi): We might need to suspend not only timer queue but also |
+ // e.g. loading tasks or postMessage. |
+ SuspendTimerQueueWhenBackgrounded(); |
+} |
+ |
void RendererSchedulerImpl::EndIdlePeriod() { |
if (MainThreadOnly().in_idle_period_for_testing) |
return; |