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 723c40c80c276d42ce3d1e2df2c58f51dfad5742..fe291ed46b9d941092e3e8edee45e7fc9f0f6085 100644 |
| --- a/cc/scheduler/scheduler_state_machine.cc |
| +++ b/cc/scheduler/scheduler_state_machine.cc |
| @@ -47,7 +47,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
| smoothness_takes_priority_(false), |
| skip_next_begin_main_frame_to_reduce_latency_(false), |
| skip_begin_main_frame_to_reduce_latency_(false), |
| - continuous_painting_(false) { |
| + continuous_painting_(false), |
| + children_need_begin_frames_(false) { |
| } |
| const char* SchedulerStateMachine::OutputSurfaceStateToString( |
| @@ -704,10 +705,14 @@ bool SchedulerStateMachine::BeginFrameNeeded() const { |
| // duplicate frames if our new frame isn't ready in time. |
| // To poll for state with the synchronous compositor without having to draw, |
| // we rely on ShouldPollForAnticipatedDrawTriggers instead. |
| - if (!SupportsProactiveBeginFrame()) |
| + if (!SupportsProactiveBeginFrame()) { |
| + DCHECK(!BeginFrameNeededToChildren()); |
|
brianderson
2014/09/04 18:45:46
Can you add a comment regarding why we added this
|
| return BeginFrameNeededToAnimateOrDraw(); |
| + } |
| - return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted(); |
| + return (BeginFrameNeededToAnimateOrDraw() || |
| + BeginFrameNeededToChildren() || |
| + ProactiveBeginFrameWanted()); |
| } |
| bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
| @@ -733,6 +738,14 @@ bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
| return !settings_.using_synchronous_renderer_compositor; |
| } |
| +void SchedulerStateMachine::SetChildrenNeedBeginFrames( |
| + bool children_need_begin_frames) { |
| +#if !defined(OS_ANDROID) && !defined(OS_MACOSX) |
|
brianderson
2014/09/04 18:45:46
We try to avoid platforms-specific defines in cc i
|
| + DCHECK(settings_.begin_frame_publisher && !settings_.begin_frame_receiver); |
| +#endif |
| + children_need_begin_frames_ = children_need_begin_frames; |
| +} |
| + |
| // 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 { |
| @@ -766,6 +779,17 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const { |
| return needs_redraw_; |
| } |
| +bool SchedulerStateMachine::BeginFrameNeededToChildren() const { |
| + if (!HasInitializedOutputSurface()) |
| + return false; |
| + |
| + // If we can't draw, don't tick until we are notified that we can draw again. |
| + if (!can_draw_) |
| + return false; |
| + |
| + return children_need_begin_frames_; |
| +} |
| + |
| // These are cases where we are very likely to draw soon, but might not |
| // actually have a new frame to draw when we receive the next BeginImplFrame. |
| // Proactively requesting the BeginImplFrame helps hide the round trip latency |