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 94016f3d5eb297c62ec496543749905254c4eba9..5a52921ab015193001ac1bbcd7de779db91b9893 100644 |
| --- a/cc/scheduler/scheduler_state_machine.cc |
| +++ b/cc/scheduler/scheduler_state_machine.cc |
| @@ -49,7 +49,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
| skip_next_begin_main_frame_to_reduce_latency_(false), |
| skip_begin_main_frame_to_reduce_latency_(false), |
| continuous_painting_(false), |
| - impl_latency_takes_priority_on_battery_(false) { |
| + impl_latency_takes_priority_on_battery_(false), |
| + children_need_begin_frames_(false) { |
| } |
| const char* SchedulerStateMachine::OutputSurfaceStateToString( |
| @@ -241,6 +242,7 @@ void SchedulerStateMachine::AsValueInto(base::debug::TracedValue* state, |
| state->SetBoolean("continuous_painting", continuous_painting_); |
| state->SetBoolean("impl_latency_takes_priority_on_battery", |
| impl_latency_takes_priority_on_battery_); |
| + state->SetBoolean("children_need_begin_frames", children_need_begin_frames_); |
| state->EndDictionary(); |
| } |
| @@ -719,16 +721,28 @@ void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { |
| skip_next_begin_main_frame_to_reduce_latency_ = true; |
| } |
| +bool SchedulerStateMachine::BeginFrameNeededForChildren() const { |
| + if (!HasInitializedOutputSurface()) |
| + return false; |
| + |
|
picksi1
2014/11/20 13:43:18
nit: [Background: I'm a fan of keeping !'s out of
simonhong
2014/11/20 16:24:09
Thanks! Looks more readable :)
|
| + return children_need_begin_frames_; |
| +} |
| + |
| bool SchedulerStateMachine::BeginFrameNeeded() const { |
| // Proactive BeginFrames are bad for the synchronous compositor because we |
| // have to draw when we get the BeginFrame and could end up drawing many |
| // 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()) { |
| + // Synchronous compositor doesn't have a browser. |
| + DCHECK(!children_need_begin_frames_); |
| return BeginFrameNeededToAnimateOrDraw(); |
| + } |
| - return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted(); |
| + return (BeginFrameNeededToAnimateOrDraw() || |
| + BeginFrameNeededForChildren() || |
| + ProactiveBeginFrameWanted()); |
|
picksi1
2014/11/20 13:43:18
The above code is starting to get hairy IMO! Begi
simonhong
2014/11/20 16:24:09
Hmm, I think we can understand more easily by divi
|
| } |
| bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
| @@ -754,6 +768,12 @@ bool SchedulerStateMachine::SupportsProactiveBeginFrame() const { |
| return !settings_.using_synchronous_renderer_compositor; |
| } |
| +void SchedulerStateMachine::SetChildrenNeedBeginFrames( |
| + bool children_need_begin_frames) { |
| + DCHECK(settings_.forward_begin_frames_to_children); |
| + 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 { |