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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/scheduler/renderer/renderer_scheduler_impl.h" 5 #include "components/scheduler/renderer/renderer_scheduler_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/stack_trace.h" 8 #include "base/debug/stack_trace.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 "RendererSchedulerImpl::OnRendererForegrounded"); 377 "RendererSchedulerImpl::OnRendererForegrounded");
378 helper_.CheckOnValidThread(); 378 helper_.CheckOnValidThread();
379 if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded) 379 if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded)
380 return; 380 return;
381 381
382 MainThreadOnly().renderer_backgrounded = false; 382 MainThreadOnly().renderer_backgrounded = false;
383 suspend_timers_when_backgrounded_closure_.Cancel(); 383 suspend_timers_when_backgrounded_closure_.Cancel();
384 ResumeTimerQueueWhenForegrounded(); 384 ResumeTimerQueueWhenForegrounded();
385 } 385 }
386 386
387 void RendererSchedulerImpl::OnRendererPurgeAndSuspend() {
388 helper_.CheckOnValidThread();
389 if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded)
Sami 2016/04/27 15:44:43 We should probably cancel suspend_timers_when_back
hajimehoshi 2016/04/28 10:26:58 Done.
390 return;
391 // TODO(hajimehoshi): Implement purging e.g. cache (crbug/607077)
Sami 2016/04/27 15:44:43 Have you thought about what kind of interfaces wou
hajimehoshi 2016/04/28 10:26:58 Right. Moved this comment to RenderThreadImpl and
392 SuspendTimerQueueWhenBackgrounded();
Sami 2016/04/27 15:44:43 We should think about whether we need to suspend o
hajimehoshi 2016/04/28 10:26:58 Good point, we might need to do what you suggest.
393 }
394
387 void RendererSchedulerImpl::EndIdlePeriod() { 395 void RendererSchedulerImpl::EndIdlePeriod() {
388 if (MainThreadOnly().in_idle_period_for_testing) 396 if (MainThreadOnly().in_idle_period_for_testing)
389 return; 397 return;
390 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), 398 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"),
391 "RendererSchedulerImpl::EndIdlePeriod"); 399 "RendererSchedulerImpl::EndIdlePeriod");
392 helper_.CheckOnValidThread(); 400 helper_.CheckOnValidThread();
393 idle_helper_.EndIdlePeriod(); 401 idle_helper_.EndIdlePeriod();
394 } 402 }
395 403
396 void RendererSchedulerImpl::EndIdlePeriodForTesting( 404 void RendererSchedulerImpl::EndIdlePeriodForTesting(
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 } 1253 }
1246 MainThreadOnly().have_reported_blocking_intervention_since_navigation = 1254 MainThreadOnly().have_reported_blocking_intervention_since_navigation =
1247 true; 1255 true;
1248 BroadcastConsoleWarning( 1256 BroadcastConsoleWarning(
1249 "Deferred long-running timer task(s) to improve scrolling smoothness. " 1257 "Deferred long-running timer task(s) to improve scrolling smoothness. "
1250 "See crbug.com/574343."); 1258 "See crbug.com/574343.");
1251 } 1259 }
1252 } 1260 }
1253 1261
1254 } // namespace scheduler 1262 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/renderer_scheduler_impl.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698