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..167b79691e4ac46a01a7ec85832b0ec88199877b 100644 |
| --- a/content/renderer/scheduler/renderer_scheduler_impl.h |
| +++ b/content/renderer/scheduler/renderer_scheduler_impl.h |
| @@ -10,6 +10,7 @@ |
| #include "base/threading/thread_checker.h" |
| #include "cc/test/test_now_source.h" |
| #include "content/renderer/scheduler/cancelable_closure_holder.h" |
| +#include "content/renderer/scheduler/deadline_task_runner.h" |
| #include "content/renderer/scheduler/renderer_scheduler.h" |
| #include "content/renderer/scheduler/single_thread_idle_task_runner.h" |
| #include "content/renderer/scheduler/task_queue_manager.h" |
| @@ -53,6 +54,7 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| private: |
| friend class RendererSchedulerImplTest; |
| + friend class MockRendererSchedulerImpl; |
| // Keep RendererSchedulerImpl::TaskQueueIdToString in sync with this enum. |
| enum QueueId { |
| @@ -117,21 +119,27 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| // Returns the current scheduler policy. Must be called from the main thread. |
| Policy SchedulerPolicy() const; |
| - // Posts a call to UpdatePolicy on the control runner to be run after |delay| |
| - void PostUpdatePolicyOnControlRunner(base::TimeDelta delay); |
| + // Schedules an immediate PolicyUpdate, if there isn't one already pending and |
| + // sets |policy_may_need_update_|. Note |incoming_signals_lock_| must be |
| + // locked. |
| + void EnsureUgentPolicyUpdatePostedOnMainThread( |
|
Sami
2015/03/12 18:15:22
s/Ugent/Urgent/
alex clarke (OOO till 29th)
2015/03/12 18:24:08
Done.
|
| + const tracked_objects::Location& from_here); |
| // Update the policy if a new signal has arrived. Must be called from the main |
| // thread. |
| void MaybeUpdatePolicy(); |
| - // Updates the scheduler policy. Must be called from the main thread. |
| + // Locks |incoming_signals_lock_| and updates the scheduler policy. |
| + // Must be called from the main thread. |
| void UpdatePolicy(); |
| + virtual void UpdatePolicyLocked(); |
| // 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 |
| // called with |incoming_signals_lock_| held. |
| - Policy ComputeNewPolicy(base::TimeDelta* new_policy_duration); |
| + Policy ComputeNewPolicy(base::TimeDelta* new_policy_duration, |
|
Sami
2015/03/12 18:15:22
nit: I'd swap the arguments so that the out argume
alex clarke (OOO till 29th)
2015/03/12 18:24:08
Good point, that's actually in the style guide.
|
| + base::TimeTicks now); |
| // An input event of some sort happened, the policy may need updating. |
| void UpdateForInputEvent(blink::WebInputEvent::Type type); |
| @@ -158,6 +166,7 @@ class CONTENT_EXPORT RendererSchedulerImpl : public RendererScheduler { |
| scoped_refptr<SingleThreadIdleTaskRunner> idle_task_runner_; |
| base::Closure update_policy_closure_; |
| + DeadlineTaskRunner delayed_update_policy_runner_; |
| CancelableClosureHolder end_idle_period_closure_; |
| // Don't access current_policy_ directly, instead use SchedulerPolicy(). |