Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 423773002: Unified BeginFrame scheduling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WIP in mac and android Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..f3336dbac486ea08a3e8465eb9ab215555a2b2c3 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(
@@ -705,9 +706,11 @@ bool SchedulerStateMachine::BeginFrameNeeded() const {
// To poll for state with the synchronous compositor without having to draw,
// we rely on ShouldPollForAnticipatedDrawTriggers instead.
if (!SupportsProactiveBeginFrame())
- return BeginFrameNeededToAnimateOrDraw();
+ return (BeginFrameNeededToAnimateOrDraw() || BeginFrameNeededToChildren());
brianderson 2014/08/28 02:48:07 This should not include BeginFrameNeededToChildren
simonhong 2014/09/03 21:02:23 Done.
- return BeginFrameNeededToAnimateOrDraw() || ProactiveBeginFrameWanted();
+ return (BeginFrameNeededToAnimateOrDraw() ||
+ BeginFrameNeededToChildren() ||
brianderson 2014/08/28 02:48:07 BeginFrameNeededToChildren belongs in ProactiveBeg
simonhong 2014/09/03 21:02:23 How Browser knows whether Renderer is slow or not
brianderson 2014/09/04 18:45:45 Nevermind about my comment here. What you have is
+ ProactiveBeginFrameWanted());
}
bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const {
@@ -733,6 +736,12 @@ bool SchedulerStateMachine::SupportsProactiveBeginFrame() const {
return !settings_.using_synchronous_renderer_compositor;
}
+void SchedulerStateMachine::SetChildrenNeedBeginFrames(
+ bool children_need_begin_frames) {
+ DCHECK(settings_.begin_frame_publisher && !settings_.begin_frame_receiver);
+ 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 +775,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

Powered by Google App Engine
This is Rietveld 408576698