| Index: cc/scheduler/scheduler.cc
|
| diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
|
| index ca18fadd588a6d21aa18dbe75281b175334988db..9dfbe1c8ff32d41b075faf4e3fc23d0f178e5890 100644
|
| --- a/cc/scheduler/scheduler.cc
|
| +++ b/cc/scheduler/scheduler.cc
|
| @@ -325,19 +325,21 @@ base::TimeTicks Scheduler::LastBeginImplFrameTime() {
|
| return begin_impl_frame_args_.frame_time;
|
| }
|
|
|
| -void Scheduler::SetupNextBeginFrameIfNeeded() {
|
| - if (!task_runner_.get())
|
| +void Scheduler::SetNeedsBeginFrameIfNeeded() {
|
| + // Never call SetNeedsBeginFrames if the frame source already has the right
|
| + // value.
|
| + if (frame_source_->NeedsBeginFrames() == state_machine_.BeginFrameNeeded())
|
| return;
|
|
|
| - if (state_machine_.ShouldSetNeedsBeginFrames(
|
| - frame_source_->NeedsBeginFrames())) {
|
| - frame_source_->SetNeedsBeginFrames(state_machine_.BeginFrameNeeded());
|
| - if (!frame_source_->NeedsBeginFrames()) {
|
| - client_->SendBeginMainFrameNotExpectedSoon();
|
| - }
|
| + // Always call SetNeedsBeginFrames(true). Only call SetNeedsBeginFrames(false)
|
| + // in between BeginFrames i.e. when begin_impl_frame_state is IDLE.
|
| + if (state_machine_.BeginFrameNeeded()) {
|
| + frame_source_->SetNeedsBeginFrames(true);
|
| + } else if (state_machine_.begin_impl_frame_state() ==
|
| + SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE) {
|
| + frame_source_->SetNeedsBeginFrames(false);
|
| + client_->SendBeginMainFrameNotExpectedSoon();
|
| }
|
| -
|
| - SetupPollingMechanisms();
|
| }
|
|
|
| // We may need to poll when we can't rely on BeginFrame to advance certain
|
| @@ -715,14 +717,19 @@ void Scheduler::ProcessScheduledActions() {
|
| tracked_objects::ScopedTracker tracking_profile10(
|
| FROM_HERE_WITH_EXPLICIT_FUNCTION(
|
| "461509 Scheduler::ProcessScheduledActions10"));
|
| - SetupNextBeginFrameIfNeeded();
|
| +
|
| + SetupPollingMechanisms();
|
| +
|
| client_->DidAnticipatedDrawTimeChange(AnticipatedDrawTime());
|
|
|
| // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is fixed.
|
| tracked_objects::ScopedTracker tracking_profile11(
|
| FROM_HERE_WITH_EXPLICIT_FUNCTION(
|
| "461509 Scheduler::ProcessScheduledActions11"));
|
| +
|
| RescheduleBeginImplFrameDeadlineIfNeeded();
|
| +
|
| + SetNeedsBeginFrameIfNeeded();
|
| }
|
|
|
| scoped_refptr<base::trace_event::ConvertableToTraceFormat> Scheduler::AsValue()
|
|
|