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

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: Created 6 years, 3 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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698