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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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 ccf6b14e08e97b9dd8821ffc03a9be79635398aa..c3a4a1e272a5a6006ac49548dea5b206cdb40a0b 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -696,6 +696,11 @@ bool SchedulerStateMachine::BeginFrameNeededForChildren() const {
}
bool SchedulerStateMachine::BeginFrameNeeded() const {
+ // We can't handle BeginFrames when output surface isn't initialized.
+ // TODO(brianderson): Support output surface creation inside a BeginFrame.
+ if (!HasInitializedOutputSurface())
+ return false;
+
if (SupportsProactiveBeginFrame()) {
return (BeginFrameNeededToAnimateOrDraw() ||
BeginFrameNeededForChildren() ||
@@ -712,6 +717,29 @@ bool SchedulerStateMachine::BeginFrameNeeded() const {
return BeginFrameNeededToAnimateOrDraw();
}
+bool SchedulerStateMachine::ShouldSetNeedsBeginFrames(
+ bool frame_source_needs_begin_frames) const {
+ bool needs_begin_frame = BeginFrameNeeded();
+
+ // Never call SetNeedsBeginFrames if the frame source has the right value.
+ if (needs_begin_frame == frame_source_needs_begin_frames)
+ return false;
+
+ // Always request the BeginFrame immediately if it's needed.
+ if (needs_begin_frame)
+ return true;
+
+ // Stop requesting BeginFrames after a deadline.
+ if (begin_impl_frame_state_ == BEGIN_IMPL_FRAME_STATE_INSIDE_DEADLINE)
+ return true;
+
+ // Stop requesting BeginFrames immediately when output surface is lost.
+ if (!HasInitializedOutputSurface())
+ return true;
+
+ return false;
+}
+
bool SchedulerStateMachine::ShouldPollForAnticipatedDrawTriggers() const {
// ShouldPollForAnticipatedDrawTriggers is what we use in place of
// ProactiveBeginFrameWanted when we are using the synchronous
@@ -744,11 +772,6 @@ 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 {
- // The output surface is the provider of BeginImplFrames, so we are not going
- // to get them even if we ask for them.
- if (!HasInitializedOutputSurface())
- return false;
-
// The forced draw respects our normal draw scheduling, so we need to
// request a BeginImplFrame for it.
if (forced_redraw_state_ == FORCED_REDRAW_STATE_WAITING_FOR_DRAW)
@@ -762,11 +785,6 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const {
// Proactively requesting the BeginImplFrame helps hide the round trip latency
// of the SetNeedsBeginFrame request that has to go to the Browser.
bool SchedulerStateMachine::ProactiveBeginFrameWanted() 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())
- return false;
-
// Do not be proactive when invisible.
if (!visible_)
return false;
« 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