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

Unified Diff: cc/scheduler/scheduler.cc

Issue 1131633003: cc: Use multiple PrepareTiles approaches Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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.cc
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc
index d2520335c0cd77a605b651ec633c04462f65828c..340936166ee300e9ca5d87bc8876f105d156f308 100644
--- a/cc/scheduler/scheduler.cc
+++ b/cc/scheduler/scheduler.cc
@@ -169,6 +169,11 @@ void Scheduler::NotifyReadyToActivate() {
ProcessScheduledActions();
}
+void Scheduler::SetRequiresHighResToDraw(bool required) {
+ state_machine_.SetRequiresHighResToDraw(required);
+ ProcessScheduledActions();
+}
+
void Scheduler::NotifyReadyToDraw() {
// Future work might still needed for crbug.com/352894.
state_machine_.NotifyReadyToDraw();
@@ -200,9 +205,9 @@ void Scheduler::SetNeedsAnimate() {
ProcessScheduledActions();
}
-void Scheduler::SetNeedsPrepareTiles() {
+void Scheduler::SetNeedsPrepareTiles(bool for_commit) {
DCHECK(!IsInsideAction(SchedulerStateMachine::ACTION_PREPARE_TILES));
- state_machine_.SetNeedsPrepareTiles();
+ state_machine_.SetNeedsPrepareTiles(for_commit);
ProcessScheduledActions();
}
@@ -248,10 +253,6 @@ void Scheduler::BeginMainFrameAborted(CommitEarlyOutReason reason) {
ProcessScheduledActions();
}
-void Scheduler::DidPrepareTiles() {
- state_machine_.DidPrepareTiles();
-}
-
void Scheduler::DidLoseOutputSurface() {
TRACE_EVENT0("cc", "Scheduler::DidLoseOutputSurface");
begin_retro_frame_args_.clear();
@@ -292,8 +293,9 @@ base::TimeTicks Scheduler::LastBeginImplFrameTime() {
void Scheduler::SetupNextBeginFrameIfNeeded() {
// Never call SetNeedsBeginFrames if the frame source already has the right
// value.
- if (frame_source_->NeedsBeginFrames() != state_machine_.BeginFrameNeeded()) {
- if (state_machine_.BeginFrameNeeded()) {
+ bool begin_frames_needed = state_machine_.BeginFrameNeeded();
+ if (frame_source_->NeedsBeginFrames() != begin_frames_needed) {
+ if (begin_frames_needed) {
// Call SetNeedsBeginFrames(true) as soon as possible.
frame_source_->SetNeedsBeginFrames(true);
} else if (state_machine_.begin_impl_frame_state() ==
@@ -302,6 +304,7 @@ void Scheduler::SetupNextBeginFrameIfNeeded() {
frame_source_->SetNeedsBeginFrames(false);
client_->SendBeginMainFrameNotExpectedSoon();
}
+ state_machine_.NotifyBeginFrameSourceActive(begin_frames_needed);
}
PostBeginRetroFrameIfNeeded();
@@ -576,6 +579,13 @@ void Scheduler::ScheduleBeginImplFrameDeadline() {
begin_impl_frame_args_.frame_time + begin_impl_frame_args_.interval;
break;
case SchedulerStateMachine::
+ BEGIN_IMPL_FRAME_DEADLINE_MODE_TRY_TO_AVOID_CHECKERBOARD:
+ // We will wait up until this deadline for the ReadyToDraw signal.
+ // TODO(brianderson): Use a different timeout for touch vs. mouse wheel.
+ deadline = begin_impl_frame_args_.frame_time +
+ (1 * begin_impl_frame_args_.interval);
+ break;
+ case SchedulerStateMachine::
BEGIN_IMPL_FRAME_DEADLINE_MODE_BLOCKED_ON_READY_TO_DRAW:
// We are blocked because we are waiting for ReadyToDraw signal. We would
// post deadline after we received ReadyToDraw singal.
@@ -639,7 +649,12 @@ void Scheduler::PollToAdvanceCommitState() {
void Scheduler::DrawAndSwapIfPossible() {
DrawResult result = client_->ScheduledActionDrawAndSwapIfPossible();
- state_machine_.DidDrawIfPossibleCompleted(result);
+ state_machine_.SetDrawResult(result);
+}
+
+void Scheduler::DrawAndSwapForced() {
+ DrawResult result = client_->ScheduledActionDrawAndSwapForced();
+ state_machine_.SetDrawResult(result);
}
void Scheduler::SetDeferCommits(bool defer_commits) {
@@ -668,56 +683,60 @@ void Scheduler::ProcessScheduledActions() {
VLOG(2) << "Scheduler::ProcessScheduledActions: "
<< SchedulerStateMachine::ActionToString(action) << " "
<< state_machine_.GetStatesForDebugging();
- state_machine_.UpdateState(action);
- base::AutoReset<SchedulerStateMachine::Action>
- mark_inside_action(&inside_action_, action);
- switch (action) {
- case SchedulerStateMachine::ACTION_NONE:
- break;
- case SchedulerStateMachine::ACTION_ANIMATE:
- client_->ScheduledActionAnimate();
- break;
- case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
- client_->ScheduledActionSendBeginMainFrame();
- break;
- case SchedulerStateMachine::ACTION_COMMIT: {
- // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
- // fixed.
- tracked_objects::ScopedTracker tracking_profile4(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "461509 Scheduler::ProcessScheduledActions4"));
- client_->ScheduledActionCommit();
- break;
- }
- case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
- client_->ScheduledActionActivateSyncTree();
- break;
- case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: {
- // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
- // fixed.
- tracked_objects::ScopedTracker tracking_profile6(
- FROM_HERE_WITH_EXPLICIT_FUNCTION(
- "461509 Scheduler::ProcessScheduledActions6"));
- DrawAndSwapIfPossible();
- break;
- }
- case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
- client_->ScheduledActionDrawAndSwapForced();
- break;
- case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT:
- // No action is actually performed, but this allows the state machine to
- // advance out of its waiting to draw state without actually drawing.
- break;
- case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
- client_->ScheduledActionBeginOutputSurfaceCreation();
- break;
- case SchedulerStateMachine::ACTION_PREPARE_TILES:
- client_->ScheduledActionPrepareTiles();
- break;
- case SchedulerStateMachine::ACTION_INVALIDATE_OUTPUT_SURFACE: {
- client_->ScheduledActionInvalidateOutputSurface();
- break;
+ {
+ base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
+ &inside_action_, action);
+ switch (action) {
+ case SchedulerStateMachine::ACTION_NONE:
+ break;
+ case SchedulerStateMachine::ACTION_ANIMATE:
+ client_->ScheduledActionAnimate();
+ break;
+ case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
+ client_->ScheduledActionSendBeginMainFrame();
+ break;
+ case SchedulerStateMachine::ACTION_COMMIT: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile4(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions4"));
+ client_->ScheduledActionCommit();
+ break;
+ }
+ case SchedulerStateMachine::ACTION_ACTIVATE_SYNC_TREE:
+ client_->ScheduledActionActivateSyncTree();
+ break;
+ case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_IF_POSSIBLE: {
+ // TODO(robliao): Remove ScopedTracker below once crbug.com/461509 is
+ // fixed.
+ tracked_objects::ScopedTracker tracking_profile6(
+ FROM_HERE_WITH_EXPLICIT_FUNCTION(
+ "461509 Scheduler::ProcessScheduledActions6"));
+ DrawAndSwapIfPossible();
+ break;
+ }
+ case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_FORCED:
+ DrawAndSwapForced();
+ break;
+ case SchedulerStateMachine::ACTION_DRAW_AND_SWAP_ABORT:
+ // No action is actually performed, but this allows the state machine
+ // to
+ // advance out of its waiting to draw state without actually drawing.
+ state_machine_.SetDrawResult(DRAW_SUCCESS);
+ break;
+ case SchedulerStateMachine::ACTION_BEGIN_OUTPUT_SURFACE_CREATION:
+ client_->ScheduledActionBeginOutputSurfaceCreation();
+ break;
+ case SchedulerStateMachine::ACTION_PREPARE_TILES:
+ client_->ScheduledActionPrepareTiles();
+ break;
+ case SchedulerStateMachine::ACTION_INVALIDATE_OUTPUT_SURFACE: {
+ client_->ScheduledActionInvalidateOutputSurface();
+ break;
+ }
}
+ state_machine_.UpdateState(action);
}
} while (action != SchedulerStateMachine::ACTION_NONE);

Powered by Google App Engine
This is Rietveld 408576698