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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 792803008: cc: Split out BeginFrame needed verse proactive for commits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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_state_machine_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 ccf6b14e08e97b9dd8821ffc03a9be79635398aa..b28c03b42853f2a5c840ec1b1c2726bf1ea22c86 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -418,6 +418,10 @@ bool SchedulerStateMachine::CouldSendBeginMainFrame() const {
}
bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
+ // If begin frames are not needed, we shouldn't be sending an BeginMainFrame.
+ if (!BeginFrameNeeded())
+ return false;
+
if (!CouldSendBeginMainFrame())
return false;
@@ -437,8 +441,7 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
// user input arriving soon.
// TODO(brianderson): Allow sending BeginMainFrame while idle when the main
// thread isn't consuming user input.
- if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE &&
- BeginFrameNeeded())
brianderson 2014/12/19 23:34:06 The check for BeginFrameNeeded is so we can commit
+ if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_IDLE)
return false;
// We need a new commit for the forced redraw. This honors the
@@ -697,9 +700,8 @@ bool SchedulerStateMachine::BeginFrameNeededForChildren() const {
bool SchedulerStateMachine::BeginFrameNeeded() const {
if (SupportsProactiveBeginFrame()) {
- return (BeginFrameNeededToAnimateOrDraw() ||
- BeginFrameNeededForChildren() ||
- ProactiveBeginFrameWanted());
+ return (BeginFrameNeededToAnimateOrDrawOrCommit() ||
+ BeginFrameNeededForChildren() || ProactiveBeginFrameWanted());
sunnyps 2015/03/05 00:19:47 OR needs_commit_ here.
}
// Proactive BeginFrames are bad for the synchronous compositor because we
@@ -709,7 +711,7 @@ bool SchedulerStateMachine::BeginFrameNeeded() const {
// we rely on ShouldPollForAnticipatedDrawTriggers instead.
// Synchronous compositor doesn't have a browser.
DCHECK(!children_need_begin_frames_);
- return BeginFrameNeededToAnimateOrDraw();
+ return BeginFrameNeededToAnimateOrDrawOrCommit();
}
bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const {
@@ -717,7 +719,8 @@ bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const {
// ProactiveBeginFrameWanted when we are using the synchronous
// compositor.
if (!SupportsProactiveBeginFrame()) {
- return !BeginFrameNeededToAnimateOrDraw() && ProactiveBeginFrameWanted();
+ return !BeginFrameNeededToAnimateOrDrawOrCommit() &&
+ ProactiveBeginFrameWanted();
}
// Non synchronous compositors should rely on
@@ -743,7 +746,7 @@ void SchedulerStateMachine::SetChildrenNeedBeginFrames(
// 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 {
+bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDrawOrCommit() const {
// The output surface is the provider of BeginImplFrames, so we are not going
// to get them even if we ask for them.
if (!HasInitializedOutputSurface())
@@ -754,7 +757,7 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const {
if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
return true;
- return needs_animate_ || needs_redraw_;
+ return needs_animate_ || needs_redraw_ || needs_commit_;
sunnyps 2015/03/05 00:19:47 Remove needs_commit_ from here.
}
// These are cases where we are very likely to draw soon, but might not
« no previous file with comments | « cc/scheduler/scheduler_state_machine.h ('k') | cc/scheduler/scheduler_state_machine_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698