Index: cc/scheduler/scheduler_state_machine.cc |
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc |
index 8f38a33d7e31f7299dac0afa87a939b61ce86b8b..be27fc879050aca7afd29cfcbaf170880860305a 100644 |
--- a/cc/scheduler/scheduler_state_machine.cc |
+++ b/cc/scheduler/scheduler_state_machine.cc |
@@ -47,7 +47,8 @@ SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) |
impl_latency_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( |
@@ -712,10 +713,13 @@ 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()); |
return BeginFrameNeededToAnimateOrDraw(); |
+ } |
- return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted(); |
+ return (BeginFrameNeededToAnimateOrDraw() || BeginFrameNeededToChildren() || |
+ ProactiveBeginFrameWanted()); |
} |
bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const { |
@@ -741,6 +745,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) |
+ 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 { |
@@ -774,6 +786,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 |