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

Unified Diff: cc/scheduler/scheduler_state_machine.cc

Issue 337693005: cc: Control defer_commits logic by Scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 dea25b40871b440405ed48ea51300224770c26cb..d2704d86394e02bd57529c2730e28f3370543984 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -46,7 +46,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),
+ defer_commits_(false) {
}
const char* SchedulerStateMachine::OutputSurfaceStateToString(
@@ -236,6 +237,7 @@ scoped_ptr<base::Value> SchedulerStateMachine::AsValue() const {
minor_state->SetBoolean("skip_next_begin_main_frame_to_reduce_latency",
skip_next_begin_main_frame_to_reduce_latency_);
minor_state->SetBoolean("continuous_painting", continuous_painting_);
+ minor_state->SetBoolean("defer_commits", defer_commits_);
state->Set("minor_state", minor_state.release());
return state.PassAs<base::Value>();
@@ -438,6 +440,10 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
if (!visible_)
return false;
+ // We do not need commits if commits are deferred.
+ if (defer_commits_)
+ return false;
+
// We want to start the first commit after we get a new output surface ASAP.
if (output_surface_state_ == OUTPUT_SURFACE_WAITING_FOR_FIRST_COMMIT)
return true;
@@ -734,6 +740,10 @@ bool SchedulerStateMachine::SupportsProactiveBeginFrame() const {
return !settings_.using_synchronous_renderer_compositor;
}
+void SchedulerStateMachine::SetDeferCommits(bool defer_commits) {
+ defer_commits_ = defer_commits;
+}
+
// 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 {
@@ -746,6 +756,9 @@ bool SchedulerStateMachine::BeginFrameNeededToAnimateOrDraw() const {
if (!can_draw_)
return false;
+ if (defer_commits_)
brianderson 2014/06/17 15:57:01 Comment?
simonhong 2014/06/18 21:52:05 Done.
+ 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)
@@ -781,6 +794,9 @@ bool SchedulerStateMachine::ProactiveBeginFrameWanted() const {
if (!visible_)
return false;
+ if (defer_commits_)
brianderson 2014/06/17 15:57:01 Comment?
simonhong 2014/06/18 21:52:05 Done.
+ return false;
+
// We should proactively request a BeginImplFrame if a commit is pending
// because we will want to draw if the commit completes quickly.
if (needs_commit_ || commit_state_ != COMMIT_STATE_IDLE)

Powered by Google App Engine
This is Rietveld 408576698