summaryrefslogtreecommitdiffstats
path: root/cc/scheduler
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-13 03:03:17 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-13 03:06:51 +0000
commit4ea293f71923dd464e237f6ef581df22c625c695 (patch)
treea05083f79e4dd6d69514f8ea17815fc5153de6cf /cc/scheduler
parent4eebe74dc1fd6d3780180361f75707a6be33c3ce (diff)
downloadchromium_src-4ea293f71923dd464e237f6ef581df22c625c695.zip
chromium_src-4ea293f71923dd464e237f6ef581df22c625c695.tar.gz
chromium_src-4ea293f71923dd464e237f6ef581df22c625c695.tar.bz2
Fix failing (flaky) LayerTreeHostTestLCDNotification test.
This test failed with impl-side painting because PictureLayer did not skip commits caused by invalidating the layer during Update. Meanwhile, this CL has some changes that changed the flaky failures into always-failures. The change is to make the ThreadProxy::CommitPendingForTesting check not only if a main frame is in progress, but also if one will happen in the future. The failure was flaky because the commit would be requested but not happen immediately when impl-side painting was on due to activation (if the machine was suitably loaded at the time). I renamed CommitPendingForTesting to MainFrameWillHappenForTesting because "CommitPending" is a specific notion in the public API of the scheduler and I didn't want to confuse these two. R=ajuma, brianderson, enne BUG=402449, 397120 Review URL: https://codereview.chromium.org/462803002 Cr-Commit-Position: refs/heads/master@{#289165} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289165 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/scheduler')
-rw-r--r--cc/scheduler/scheduler.h7
-rw-r--r--cc/scheduler/scheduler_state_machine.cc17
-rw-r--r--cc/scheduler/scheduler_state_machine.h2
3 files changed, 21 insertions, 5 deletions
diff --git a/cc/scheduler/scheduler.h b/cc/scheduler/scheduler.h
index 311a71d..ce3fed7 100644
--- a/cc/scheduler/scheduler.h
+++ b/cc/scheduler/scheduler.h
@@ -98,6 +98,13 @@ class CC_EXPORT Scheduler {
void DidLoseOutputSurface();
void DidCreateAndInitializeOutputSurface();
+ // Tests do not want to shut down until all possible BeginMainFrames have
+ // occured to prevent flakiness.
+ bool MainFrameForTestingWillHappen() const {
+ return state_machine_.CommitPending() ||
+ state_machine_.CouldSendBeginMainFrame();
+ }
+
bool CommitPending() const { return state_machine_.CommitPending(); }
bool RedrawPending() const { return state_machine_.RedrawPending(); }
bool ManageTilesPending() const {
diff --git a/cc/scheduler/scheduler_state_machine.cc b/cc/scheduler/scheduler_state_machine.cc
index 723c40c..c66b650 100644
--- a/cc/scheduler/scheduler_state_machine.cc
+++ b/cc/scheduler/scheduler_state_machine.cc
@@ -418,10 +418,21 @@ bool SchedulerStateMachine::ShouldAnimate() const {
return needs_redraw_ || needs_animate_;
}
-bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
+bool SchedulerStateMachine::CouldSendBeginMainFrame() const {
if (!needs_commit_)
return false;
+ // We can not perform commits if we are not visible.
+ if (!visible_)
+ return false;
+
+ return true;
+}
+
+bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
+ if (!CouldSendBeginMainFrame())
+ return false;
+
// Only send BeginMainFrame when there isn't another commit pending already.
if (commit_state_ != COMMIT_STATE_IDLE)
return false;
@@ -433,10 +444,6 @@ bool SchedulerStateMachine::ShouldSendBeginMainFrame() const {
return false;
}
- // We do not need commits if we are not visible.
- if (!visible_)
- 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;
diff --git a/cc/scheduler/scheduler_state_machine.h b/cc/scheduler/scheduler_state_machine.h
index d92a352f..bb033a1 100644
--- a/cc/scheduler/scheduler_state_machine.h
+++ b/cc/scheduler/scheduler_state_machine.h
@@ -235,6 +235,8 @@ class CC_EXPORT SchedulerStateMachine {
continuous_painting_ = continuous_painting;
}
+ bool CouldSendBeginMainFrame() const;
+
protected:
bool BeginFrameNeededToAnimateOrDraw() const;
bool ProactiveBeginFrameWanted() const;