OLD | NEW |
---|---|
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 "RendererSchedulerImpl::OnRendererForegrounded"); | 380 "RendererSchedulerImpl::OnRendererForegrounded"); |
381 helper_.CheckOnValidThread(); | 381 helper_.CheckOnValidThread(); |
382 if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded) | 382 if (helper_.IsShutdown() || !MainThreadOnly().renderer_backgrounded) |
383 return; | 383 return; |
384 | 384 |
385 MainThreadOnly().renderer_backgrounded = false; | 385 MainThreadOnly().renderer_backgrounded = false; |
386 suspend_timers_when_backgrounded_closure_.Cancel(); | 386 suspend_timers_when_backgrounded_closure_.Cancel(); |
387 ResumeTimerQueueWhenForegrounded(); | 387 ResumeTimerQueueWhenForegrounded(); |
388 } | 388 } |
389 | 389 |
390 void RendererSchedulerImpl::SuspendRenderer() { | |
391 helper_.CheckOnValidThread(); | |
392 DCHECK(MainThreadOnly().renderer_backgrounded); | |
393 if (helper_.IsShutdown()) | |
394 return; | |
395 suspend_timers_when_backgrounded_closure_.Cancel(); | |
Sami
2016/05/12 11:31:35
Could you add a TODO about possibly suspending oth
hajimehoshi
2016/05/13 06:07:45
Done.
| |
396 SuspendTimerQueueWhenBackgrounded(); | |
397 } | |
398 | |
390 void RendererSchedulerImpl::EndIdlePeriod() { | 399 void RendererSchedulerImpl::EndIdlePeriod() { |
391 if (MainThreadOnly().in_idle_period_for_testing) | 400 if (MainThreadOnly().in_idle_period_for_testing) |
392 return; | 401 return; |
393 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), | 402 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("renderer.scheduler"), |
394 "RendererSchedulerImpl::EndIdlePeriod"); | 403 "RendererSchedulerImpl::EndIdlePeriod"); |
395 helper_.CheckOnValidThread(); | 404 helper_.CheckOnValidThread(); |
396 idle_helper_.EndIdlePeriod(); | 405 idle_helper_.EndIdlePeriod(); |
397 } | 406 } |
398 | 407 |
399 void RendererSchedulerImpl::EndIdlePeriodForTesting( | 408 void RendererSchedulerImpl::EndIdlePeriodForTesting( |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1260 } | 1269 } |
1261 MainThreadOnly().have_reported_blocking_intervention_since_navigation = | 1270 MainThreadOnly().have_reported_blocking_intervention_since_navigation = |
1262 true; | 1271 true; |
1263 BroadcastConsoleWarning( | 1272 BroadcastConsoleWarning( |
1264 "Deferred long-running timer task(s) to improve scrolling smoothness. " | 1273 "Deferred long-running timer task(s) to improve scrolling smoothness. " |
1265 "See crbug.com/574343."); | 1274 "See crbug.com/574343."); |
1266 } | 1275 } |
1267 } | 1276 } |
1268 | 1277 |
1269 } // namespace scheduler | 1278 } // namespace scheduler |
OLD | NEW |