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..e01f7f2cd2debbedbb161a4d66625818b41e63e5 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,27 @@ void SchedulerStateMachine::SetSkipNextBeginMainFrameToReduceLatency() { |
skip_next_begin_main_frame_to_reduce_latency_ = true; |
} |
+bool SchedulerStateMachine::BeginFrameNeededForChildren() const { |
+ if (HasInitializedOutputSurface()) |
+ return children_need_begin_frames_; |
+ |
+ return false; |
+} |
+ |
bool SchedulerStateMachine::BeginFrameNeeded() const { |
+ if (SupportsProactiveBeginFrame()) |
brianderson
2014/11/21 02:08:05
Please use brackets here.
simonhong
2014/11/21 15:42:53
Done.
|
+ return (BeginFrameNeededToAnimateOrDraw() || |
+ BeginFrameNeededForChildren() || |
+ ProactiveBeginFrameWanted()); |
+ |
// 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()) |
- return BeginFrameNeededToAnimateOrDraw(); |
- |
- return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted(); |
+ // Synchronous compositor doesn't have a browser. |
+ DCHECK(!children_need_begin_frames_); |
+ return BeginFrameNeededToAnimateOrDraw(); |
} |
bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
@@ -754,6 +767,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 { |