Chromium Code Reviews| Index: cc/scheduler/scheduler_state_machine.cc |
| diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
| index ccf6b14e08e97b9dd8821ffc03a9be79635398aa..b28c03b42853f2a5c840ec1b1c2726bf1ea22c86 100644 |
| --- a/cc/scheduler/scheduler_state_machine.cc |
| +++ b/cc/scheduler/scheduler_state_machine.cc |
| @@ -418,6 +418,10 @@ bool SchedulerStateMachine::CouldSendBeginMainFrame() const { |
| } |
| bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
| + // If begin frames are not needed, we shouldn't be sending an BeginMainFrame. |
| + if (!BeginFrameNeeded()) |
| + return false; |
| + |
| if (!CouldSendBeginMainFrame()) |
| return false; |
| @@ -437,8 +441,7 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const { |
| // user input arriving soon. |
| // TODO(brianderson): Allow sending BeginMainFrame while idle when the main |
| // thread isn't consuming user input. |
| - if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE && |
| - BeginFrameNeeded()) |
|
brianderson
2014/12/19 23:34:06
The check for BeginFrameNeeded is so we can commit
|
| + if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE) |
| return false; |
| // We need a new commit for the forced redraw. This honors the |
| @@ -697,9 +700,8 @@ bool SchedulerStateMachine::BeginFrameNeededForChildren() const { |
| bool SchedulerStateMachine::BeginFrameNeeded() const { |
| if (SupportsProactiveBeginFrame()) { |
| - return (BeginFrameNeededToAnimateOrDraw() || |
| - BeginFrameNeededForChildren() || |
| - ProactiveBeginFrameWanted()); |
| + return (BeginFrameNeededToAnimateOrDrawOrCommit() || |
| + BeginFrameNeededForChildren() || ProactiveBeginFrameWanted()); |
|
sunnyps
2015/03/05 00:19:47
OR needs_commit_ here.
|
| } |
| // Proactive BeginFrames are bad for the synchronous compositor because we |
| @@ -709,7 +711,7 @@ bool SchedulerStateMachine::BeginFrameNeeded() const { |
| // we rely on ShouldPollForAnticipatedDrawTriggers instead. |
| // Synchronous compositor doesn't have a browser. |
| DCHECK(!children_need_begin_frames_); |
| - return BeginFrameNeededToAnimateOrDraw(); |
| + return BeginFrameNeededToAnimateOrDrawOrCommit(); |
| } |
| bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
| @@ -717,7 +719,8 @@ bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
| // ProactiveBeginFrameWanted when we are using the synchronous |
| // compositor. |
| if (!SupportsProactiveBeginFrame()) { |
| - return !BeginFrameNeededToAnimateOrDraw() && ProactiveBeginFrameWanted(); |
| + return !BeginFrameNeededToAnimateOrDrawOrCommit() && |
| + ProactiveBeginFrameWanted(); |
| } |
| // Non synchronous compositors should rely on |
| @@ -743,7 +746,7 @@ void SchedulerStateMachine::SetChildrenNeedBeginFrames( |
| // These are the cases where we definitely (or almost definitely) have a |
| // new frame to animate and/or draw and can draw. |
| -bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
| +bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDrawOrCommit() const { |
| // The output surface is the provider of BeginImplFrames, so we are not going |
| // to get them even if we ask for them. |
| if (!HasInitializedOutputSurface()) |
| @@ -754,7 +757,7 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
| if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW) |
| return true; |
| - return needs_animate_ || needs_redraw_; |
| + return needs_animate_ || needs_redraw_ || needs_commit_; |
|
sunnyps
2015/03/05 00:19:47
Remove needs_commit_ from here.
|
| } |
| // These are cases where we are very likely to draw soon, but might not |