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..1bd5d15bfa102e53e663a1bbc69188e9a830534f 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 initiate_next_long_idle_period_after_wakeup_closure_; |
// Don't access current_policy_ directly, instead use SchedulerPolicy(). |
Policy current_policy_; |
+ bool in_idle_period_; |
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. |