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

Unified Diff: components/scheduler/renderer/renderer_scheduler_impl.cc

Issue 1914143002: Experimental 'purging and suspending' backgrounded tabs behind the flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address on haraken's review Created 4 years, 7 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: 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;

Powered by Google App Engine
This is Rietveld 408576698