Chromium Code Reviews| Index: content/renderer/scheduler/renderer_scheduler_impl.h |
| diff --git a/content/renderer/scheduler/renderer_scheduler_impl.h b/content/renderer/scheduler/renderer_scheduler_impl.h |
| index c908a974a0d8f21cf24f8cb34d36fc053a1d68c8..3b21599e38a4c13b30d73c27a26061f89991458d 100644 |
| --- a/content/renderer/scheduler/renderer_scheduler_impl.h |
| +++ b/content/renderer/scheduler/renderer_scheduler_impl.h |
| @@ -111,6 +111,12 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| // The time we should stay in a priority-escalated mode after an input event. |
| static const int kPriorityEscalationAfterInputMillis = 100; |
| + // The maximum length of an idle period. |
| + static const int kMaximumIdlePeriodMillis = 50; |
| + |
| + // The minimum delay to wait between retrying to initiate a long idle time. |
| + static const int kRetryInitiateLongIdlePeriodDelayMillis = 1; |
| + |
| // IdleTaskDeadlineSupplier Implementation: |
| void CurrentIdleTaskDeadlineCallback(base::TimeTicks* deadline_out) const; |
| @@ -127,6 +133,10 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| // Updates the scheduler policy. Must be called from the main thread. |
| void UpdatePolicy(); |
| + // Returns the amount of time left in the current input escalated priority |
| + // policy. |
| + base::TimeDelta TimeLeftInInputEscalatedPolicy() const; |
| + |
| // Helper for computing the new policy. |new_policy_duration| will be filled |
| // with the amount of time after which the policy should be updated again. If |
| // the duration is zero, a new policy update will not be scheduled. Must be |
| @@ -141,6 +151,17 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| // input was processed. |
| void DidProcessInputEvent(base::TimeTicks begin_frame_time); |
| + // Returns true if we should initiate a long idle time now. Fills in |
| + // |next_long_idle_period_delay_out| with the next time we should try to |
| + // initiate the next idle period. |
| + bool ShouldStartLongIdlePeriod( |
| + const base::TimeTicks now, |
| + base::TimeDelta* next_long_idle_period_delay_out); |
| + |
| + // Initiate a long idle period. |
| + void InitiateLongIdlePeriod(); |
| + void InitiateLongIdlePeriodAfterWakeup(); |
| + |
| // Start and end an idle period. |
| void StartIdlePeriod(); |
| void EndIdlePeriod(); |
| @@ -159,11 +180,15 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| base::Closure update_policy_closure_; |
| CancelableClosureHolder end_idle_period_closure_; |
| + CancelableClosureHolder initiate_next_long_idle_period_closure_; |
| + CancelableClosureHolder after_wakeup_initiate_next_long_idle_period_closure_; |
|
Sami
2015/03/04 18:26:40
nit: swap the names around to match the function n
|
| // Don't access current_policy_ directly, instead use SchedulerPolicy(). |
| Policy current_policy_; |
| + bool in_idle_period_; |
|
Sami
2015/03/04 18:26:40
Looks like this isn't initialized in the construct
rmcilroy
2015/03/05 11:48:52
Done and done.
|
| base::TimeTicks estimated_next_frame_begin_; |
| + base::TimeTicks current_policy_expiration_time_; |
| // The incoming_signals_lock_ mutex protects access to all variables in the |
| // (contiguous) block below. |