diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 00:03:48 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-17 00:03:48 +0000 |
commit | faa765cfb116065c46ccb026465326231441252d (patch) | |
tree | 8f3edd63fa853d0d261171c0ef0ce813c643b31e /cc | |
parent | ec7540f6e23eeddfc6a4f32db39ce2be08bca175 (diff) | |
download | chromium_src-faa765cfb116065c46ccb026465326231441252d.zip chromium_src-faa765cfb116065c46ccb026465326231441252d.tar.gz chromium_src-faa765cfb116065c46ccb026465326231441252d.tar.bz2 |
cc: Do not request redraw on commit when impl-side painting
When impl-side painting, we draw when the pending tree
becomes active and should no longer draw on commit.
BUG=168724
Review URL: https://chromiumcodereview.appspot.com/11830040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177274 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/cc.gyp | 2 | ||||
-rw-r--r-- | cc/layer_tree_host_unittest_scroll.cc | 10 | ||||
-rw-r--r-- | cc/scheduler.cc | 8 | ||||
-rw-r--r-- | cc/scheduler.h | 11 | ||||
-rw-r--r-- | cc/scheduler_settings.cc | 18 | ||||
-rw-r--r-- | cc/scheduler_settings.h | 23 | ||||
-rw-r--r-- | cc/scheduler_state_machine.cc | 9 | ||||
-rw-r--r-- | cc/scheduler_state_machine.h | 6 | ||||
-rw-r--r-- | cc/scheduler_state_machine_unittest.cc | 114 | ||||
-rw-r--r-- | cc/scheduler_unittest.cc | 30 | ||||
-rw-r--r-- | cc/thread_proxy.cc | 5 |
11 files changed, 179 insertions, 57 deletions
@@ -206,6 +206,8 @@ 'ring_buffer.h', 'scheduler.cc', 'scheduler.h', + 'scheduler_settings.cc', + 'scheduler_settings.h', 'scheduler_state_machine.cc', 'scheduler_state_machine.h', 'scoped_ptr_algorithm.h', diff --git a/cc/layer_tree_host_unittest_scroll.cc b/cc/layer_tree_host_unittest_scroll.cc index 5c30a22..bfb5e5f 100644 --- a/cc/layer_tree_host_unittest_scroll.cc +++ b/cc/layer_tree_host_unittest_scroll.cc @@ -537,6 +537,13 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { return can_activate_; } + virtual void commitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { + // We force a second draw here of the first commit before activating + // the second commit. + if (impl->activeTree()->source_frame_number() == 0) + impl->setNeedsRedraw(); + } + virtual void drawLayersOnThread(LayerTreeHostImpl* impl) OVERRIDE { ImplSidePaintingScrollTest::drawLayersOnThread(impl); @@ -558,6 +565,9 @@ class ImplSidePaintingScrollTestSimple : public ImplSidePaintingScrollTest { EXPECT_VECTOR_EQ(root->scrollDelta(), impl_thread_scroll1_); EXPECT_VECTOR_EQ(root->sentScrollDelta(), gfx::Vector2d()); postSetNeedsCommitToMainThread(); + + // commitCompleteOnThread will trigger this function again + // and cause us to take the else clause. } else { can_activate_ = true; ASSERT_TRUE(pending_root); diff --git a/cc/scheduler.cc b/cc/scheduler.cc index c485a38..dbe96dd 100644 --- a/cc/scheduler.cc +++ b/cc/scheduler.cc @@ -10,9 +10,13 @@ namespace cc { -Scheduler::Scheduler(SchedulerClient* client, scoped_ptr<FrameRateController> frameRateController) - : m_client(client) +Scheduler::Scheduler(SchedulerClient* client, + scoped_ptr<FrameRateController> frameRateController, + const SchedulerSettings& schedulerSettings) + : m_settings(schedulerSettings) + , m_client(client) , m_frameRateController(frameRateController.Pass()) + , m_stateMachine(schedulerSettings) , m_insideProcessScheduledActions(false) { DCHECK(m_client); diff --git a/cc/scheduler.h b/cc/scheduler.h index 02ff3ae..6d2bad9 100644 --- a/cc/scheduler.h +++ b/cc/scheduler.h @@ -11,6 +11,7 @@ #include "cc/cc_export.h" #include "cc/frame_rate_controller.h" #include "cc/layer_tree_host.h" +#include "cc/scheduler_settings.h" #include "cc/scheduler_state_machine.h" namespace cc { @@ -49,9 +50,11 @@ protected: class CC_EXPORT Scheduler : FrameRateControllerClient { public: - static scoped_ptr<Scheduler> create(SchedulerClient* client, scoped_ptr<FrameRateController> frameRateController) + static scoped_ptr<Scheduler> create(SchedulerClient* client, + scoped_ptr<FrameRateController> frameRateController, + const SchedulerSettings& schedulerSettings) { - return make_scoped_ptr(new Scheduler(client, frameRateController.Pass())); + return make_scoped_ptr(new Scheduler(client, frameRateController.Pass(), schedulerSettings)); } virtual ~Scheduler(); @@ -97,10 +100,12 @@ public: virtual void vsyncTick(bool throttled) OVERRIDE; private: - Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>); + Scheduler(SchedulerClient*, scoped_ptr<FrameRateController>, + const SchedulerSettings& schedulerSettings); void processScheduledActions(); + const SchedulerSettings m_settings; SchedulerClient* m_client; scoped_ptr<FrameRateController> m_frameRateController; SchedulerStateMachine m_stateMachine; diff --git a/cc/scheduler_settings.cc b/cc/scheduler_settings.cc new file mode 100644 index 0000000..e0b8827 --- /dev/null +++ b/cc/scheduler_settings.cc @@ -0,0 +1,18 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/scheduler_settings.h" + +namespace cc { + +SchedulerSettings::SchedulerSettings() + : implSidePainting(false) +{ +} + +SchedulerSettings::~SchedulerSettings() +{ +} + +} // namespace cc diff --git a/cc/scheduler_settings.h b/cc/scheduler_settings.h new file mode 100644 index 0000000..9646f23 --- /dev/null +++ b/cc/scheduler_settings.h @@ -0,0 +1,23 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CC_SCHEDULER_SETTINGS_H_ +#define CC_SCHEDULER_SETTINGS_H_ + +#include "cc/cc_export.h" + +namespace cc { + +class CC_EXPORT SchedulerSettings +{ +public: + SchedulerSettings(); + ~SchedulerSettings(); + + bool implSidePainting; +}; + +} // namespace cc + +#endif // CC_SCHEDULER_SETTINGS_H_ diff --git a/cc/scheduler_state_machine.cc b/cc/scheduler_state_machine.cc index f9d8cbc..5d62297 100644 --- a/cc/scheduler_state_machine.cc +++ b/cc/scheduler_state_machine.cc @@ -9,8 +9,9 @@ namespace cc { -SchedulerStateMachine::SchedulerStateMachine() - : m_commitState(COMMIT_STATE_IDLE) +SchedulerStateMachine::SchedulerStateMachine(const SchedulerSettings& settings) + : m_settings(settings) + , m_commitState(COMMIT_STATE_IDLE) , m_currentFrameNumber(0) , m_lastFrameNumberWhereDrawWasCalled(-1) , m_lastFrameNumberWhereTreeActivationAttempted(-1) @@ -209,7 +210,9 @@ void SchedulerStateMachine::updateState(Action action) m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_FORCED_DRAW; else m_commitState = COMMIT_STATE_WAITING_FOR_FIRST_DRAW; - m_needsRedraw = true; + // When impl-side painting, we draw on activation instead of on commit. + if (!m_settings.implSidePainting) + m_needsRedraw = true; if (m_drawIfPossibleFailed) m_lastFrameNumberWhereDrawWasCalled = -1; diff --git a/cc/scheduler_state_machine.h b/cc/scheduler_state_machine.h index 1186827..5959bff 100644 --- a/cc/scheduler_state_machine.h +++ b/cc/scheduler_state_machine.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "cc/cc_export.h" +#include "cc/scheduler_settings.h" namespace cc { @@ -24,7 +25,8 @@ namespace cc { // make testing cleaner. class CC_EXPORT SchedulerStateMachine { public: - SchedulerStateMachine(); + // settings must be valid for the lifetime of this class. + SchedulerStateMachine(const SchedulerSettings& settings); enum CommitState { COMMIT_STATE_IDLE, @@ -149,6 +151,8 @@ protected: bool hasDrawnThisFrame() const; bool hasAttemptedTreeActivationThisFrame() const; + const SchedulerSettings m_settings; + CommitState m_commitState; int m_currentFrameNumber; diff --git a/cc/scheduler_state_machine_unittest.cc b/cc/scheduler_state_machine_unittest.cc index 67fc684..686543c5 100644 --- a/cc/scheduler_state_machine_unittest.cc +++ b/cc/scheduler_state_machine_unittest.cc @@ -4,9 +4,11 @@ #include "cc/scheduler_state_machine.h" +#include "cc/scheduler.h" #include "testing/gtest/include/gtest/gtest.h" namespace cc { + namespace { const SchedulerStateMachine::CommitState allCommitStates[] = { @@ -19,6 +21,8 @@ const SchedulerStateMachine::CommitState allCommitStates[] = { // Exposes the protected state fields of the SchedulerStateMachine for testing class StateMachine : public SchedulerStateMachine { public: + StateMachine(const SchedulerSettings& schedulerSettings) + : SchedulerStateMachine(schedulerSettings) { } void setCommitState(CommitState cs) { m_commitState = cs; } CommitState commitState() const { return m_commitState; } @@ -37,9 +41,11 @@ public: TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) { + SchedulerSettings defaultSchedulerSettings; + // If no commit needed, do nothing - { - StateMachine state; + { + StateMachine state(defaultSchedulerSettings); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setCanBeginFrame(true); state.setNeedsRedraw(false); @@ -56,7 +62,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) // If commit requested but canBeginFrame is still false, do nothing. { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setNeedsRedraw(false); state.setVisible(true); @@ -73,7 +79,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) // If commit requested, begin a frame { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_IDLE); state.setCanBeginFrame(true); state.setNeedsRedraw(false); @@ -83,7 +89,7 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) // Begin the frame, make sure needsCommit and commitState update correctly. { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.updateState(SchedulerStateMachine::ACTION_BEGIN_FRAME); @@ -95,7 +101,8 @@ TEST(SchedulerStateMachineTest, TestNextActionBeginsFrameIfNeeded) TEST(SchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanDraw(true); state.setNeedsForcedRedraw(); EXPECT_FALSE(state.redrawPending()); @@ -104,7 +111,8 @@ TEST(SchedulerStateMachineTest, TestSetForcedRedrawDoesNotSetsNormalRedraw) TEST(SchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -130,7 +138,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawSetsNeedsCommitAndDoesNotDrawAgain TEST(SchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveNeedsRedraw) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -159,7 +168,8 @@ TEST(SchedulerStateMachineTest, TestSetNeedsRedrawDuringFailedDrawDoesNotRemoveN TEST(SchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -197,7 +207,8 @@ TEST(SchedulerStateMachineTest, TestCommitAfterFailedDrawAllowsDrawInSameFrame) TEST(SchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAllowDrawInSameFrame) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -246,7 +257,8 @@ TEST(SchedulerStateMachineTest, TestCommitAfterFailedAndSuccessfulDrawDoesNotAll TEST(SchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTheNextCommit) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -286,7 +298,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawsWillEventuallyForceADrawAfterTheN TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -317,7 +330,8 @@ TEST(SchedulerStateMachineTest, TestFailedDrawIsRetriedNextVSync) TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) { - SchedulerStateMachine state; + SchedulerSettings defaultSchedulerSettings; + SchedulerStateMachine state(defaultSchedulerSettings); state.setVisible(true); state.setCanDraw(true); state.setNeedsRedraw(); @@ -345,11 +359,13 @@ TEST(SchedulerStateMachineTest, TestDoestDrawTwiceInSameFrame) TEST(SchedulerStateMachineTest, TestNextActionDrawsOnVSync) { + SchedulerSettings defaultSchedulerSettings; + // When not on vsync, or on vsync but not visible, don't draw. size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { for (unsigned j = 0; j < 2; ++j) { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCommitState(allCommitStates[i]); bool visible = j; if (!visible) { @@ -370,7 +386,7 @@ TEST(SchedulerStateMachineTest, TestNextActionDrawsOnVSync) // When on vsync, or not on vsync but needsForcedRedraw set, should always draw except if you're ready to commit, in which case commit. for (size_t i = 0; i < numCommitStates; ++i) { for (unsigned j = 0; j < 2; ++j) { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCanDraw(true); state.setCommitState(allCommitStates[i]); bool forcedDraw = j; @@ -401,11 +417,13 @@ TEST(SchedulerStateMachineTest, TestNextActionDrawsOnVSync) TEST(SchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) { + SchedulerSettings defaultSchedulerSettings; + size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { // There shouldn't be any drawing regardless of vsync. for (unsigned j = 0; j < 2; ++j) { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCommitState(allCommitStates[i]); state.setVisible(false); state.setNeedsRedraw(true); @@ -425,11 +443,13 @@ TEST(SchedulerStateMachineTest, TestNoCommitStatesRedrawWhenInvisible) TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) { + SchedulerSettings defaultSchedulerSettings; + size_t numCommitStates = sizeof(allCommitStates) / sizeof(SchedulerStateMachine::CommitState); for (size_t i = 0; i < numCommitStates; ++i) { // There shouldn't be any drawing regardless of vsync. for (unsigned j = 0; j < 2; ++j) { - StateMachine state; + StateMachine state(defaultSchedulerSettings); state.setCommitState(allCommitStates[i]); state.setVisible(false); state.setNeedsRedraw(true); @@ -445,7 +465,8 @@ TEST(SchedulerStateMachineTest, TestCanRedraw_StopsDraw) TEST(SchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgress) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_WAITING_FOR_FIRST_DRAW); state.setCanBeginFrame(true); state.setNeedsCommit(); @@ -457,7 +478,8 @@ TEST(SchedulerStateMachineTest, TestCanRedrawWithWaitingForFirstDrawMakesProgres TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setNeedsCommit(); state.setVisible(true); @@ -496,7 +518,8 @@ TEST(SchedulerStateMachineTest, TestSetNeedsCommitIsNotLost) TEST(SchedulerStateMachineTest, TestFullCycle) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -539,7 +562,8 @@ TEST(SchedulerStateMachineTest, TestFullCycle) TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -586,14 +610,16 @@ TEST(SchedulerStateMachineTest, TestFullCycleWithCommitRequestInbetween) TEST(SchedulerStateMachineTest, TestRequestCommitInvisible) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setNeedsCommit(); EXPECT_EQ(SchedulerStateMachine::ACTION_NONE, state.nextAction()); } TEST(SchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -632,7 +658,8 @@ TEST(SchedulerStateMachineTest, TestGoesInvisibleBeforeBeginFrameCompletes) TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -655,7 +682,8 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenCompletelyIdle) TEST(SchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRecreating) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -692,7 +720,8 @@ TEST(SchedulerStateMachineTest, TestContextLostWhenIdleAndCommitRequestedWhileRe TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -735,7 +764,8 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgress) TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCommitRequested) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -780,7 +810,8 @@ TEST(SchedulerStateMachineTest, TestContextLostWhileCommitInProgressAndAnotherCo TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setVisible(true); state.setCanDraw(true); @@ -809,7 +840,8 @@ TEST(SchedulerStateMachineTest, TestFinishAllRenderingWhileContextLost) TEST(SchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(false); state.setNeedsCommit(); @@ -819,7 +851,8 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenInvisibleAndForceCommit) TEST(SchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceCommit) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setVisible(true); state.setCanDraw(true); state.setNeedsCommit(); @@ -829,7 +862,8 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenCanBeginFrameFalseAndForceComm TEST(SchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(false); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS); @@ -846,7 +880,8 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenCommitInProgress) TEST(SchedulerStateMachineTest, TestBeginFrameWhenForcedCommitInProgress) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(false); state.setCommitState(SchedulerStateMachine::COMMIT_STATE_FRAME_IN_PROGRESS); @@ -865,7 +900,8 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenForcedCommitInProgress) TEST(SchedulerStateMachineTest, TestBeginFrameWhenContextLost) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -877,7 +913,8 @@ TEST(SchedulerStateMachineTest, TestBeginFrameWhenContextLost) TEST(SchedulerStateMachineTest, TestImmediateBeginFrame) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -907,7 +944,8 @@ TEST(SchedulerStateMachineTest, TestImmediateBeginFrame) TEST(SchedulerStateMachineTest, TestImmediateBeginFrameDuringCommit) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -941,7 +979,8 @@ TEST(SchedulerStateMachineTest, TestImmediateBeginFrameDuringCommit) TEST(SchedulerStateMachineTest, ImmediateBeginFrameWhileInvisible) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(true); @@ -983,7 +1022,8 @@ TEST(SchedulerStateMachineTest, ImmediateBeginFrameWhileInvisible) TEST(SchedulerStateMachineTest, ImmediateBeginFrameWhileCantDraw) { - StateMachine state; + SchedulerSettings defaultSchedulerSettings; + StateMachine state(defaultSchedulerSettings); state.setCanBeginFrame(true); state.setVisible(true); state.setCanDraw(false); diff --git a/cc/scheduler_unittest.cc b/cc/scheduler_unittest.cc index 74384ec..dc10309 100644 --- a/cc/scheduler_unittest.cc +++ b/cc/scheduler_unittest.cc @@ -69,7 +69,8 @@ TEST(SchedulerTest, RequestCommit) { FakeSchedulerClient client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -103,7 +104,8 @@ TEST(SchedulerTest, RequestCommitAfterBeginFrame) { FakeSchedulerClient client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -137,7 +139,8 @@ TEST(SchedulerTest, TextureAcquisitionCollision) { FakeSchedulerClient client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -176,7 +179,8 @@ TEST(SchedulerTest, VisibilitySwitchWithTextureAcquisition) { FakeSchedulerClient client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); scheduler->setCanDraw(true); @@ -239,7 +243,8 @@ TEST(SchedulerTest, RequestRedrawInsideDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -266,7 +271,8 @@ TEST(SchedulerTest, RequestRedrawInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -339,7 +345,8 @@ TEST(SchedulerTest, RequestCommitInsideDraw) { SchedulerClientThatSetNeedsCommitInsideDraw client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -367,7 +374,8 @@ TEST(SchedulerTest, RequestCommitInsideFailedDraw) { SchedulerClientThatSetNeedsDrawInsideDraw client; scoped_refptr<FakeTimeSource> timeSource(new FakeTimeSource()); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource))); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, make_scoped_ptr(new FrameRateController(timeSource)), defaultSchedulerSettings); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -410,7 +418,8 @@ TEST(SchedulerTest, NoBeginFrameWhenDrawFails) SchedulerClientThatSetNeedsCommitInsideDraw client; scoped_ptr<FakeFrameRateController> controller(new FakeFrameRateController(timeSource)); FakeFrameRateController* controllerPtr = controller.get(); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>()); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>(), defaultSchedulerSettings); client.setScheduler(scheduler.get()); scheduler->setCanBeginFrame(true); scheduler->setVisible(true); @@ -447,7 +456,8 @@ TEST(SchedulerTest, NoBeginFrameWhenSwapFailsDuringForcedCommit) FakeSchedulerClient client; scoped_ptr<FakeFrameRateController> controller(new FakeFrameRateController(timeSource)); FakeFrameRateController* controllerPtr = controller.get(); - scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>()); + SchedulerSettings defaultSchedulerSettings; + scoped_ptr<Scheduler> scheduler = Scheduler::create(&client, controller.PassAs<FrameRateController>(), defaultSchedulerSettings); EXPECT_EQ(0, controllerPtr->numFramesPending()); diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc index 1cdcb55..8708c26 100644 --- a/cc/thread_proxy.cc +++ b/cc/thread_proxy.cc @@ -936,7 +936,10 @@ void ThreadProxy::initializeImplOnImplThread(CompletionEvent* completion, InputH frameRateController.reset(new FrameRateController(DelayBasedTimeSource::create(displayRefreshInterval, Proxy::implThread()))); else frameRateController.reset(new FrameRateController(Proxy::implThread())); - m_schedulerOnImplThread = Scheduler::create(this, frameRateController.Pass()); + SchedulerSettings schedulerSettings; + schedulerSettings.implSidePainting = m_layerTreeHost->settings().implSidePainting; + m_schedulerOnImplThread = Scheduler::create(this, frameRateController.Pass(), + schedulerSettings); m_schedulerOnImplThread->setVisible(m_layerTreeHostImpl->visible()); m_inputHandlerOnImplThread = scoped_ptr<InputHandler>(handler); |