Skip to content

Commit

Permalink
cc: Require high-res tiles for activation after entering NEW_CONTENT_…
Browse files Browse the repository at this point in the history
…TAKES_PRIORITY mode.

Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active
tree might be freed. We need to set RequiresHighResToDraw to ensure that
high res tiles will be required to activate pending tree.

BUG=345426,345968
TEST=cc_unittests --gtest_filter=LayerTreeHostTestHighResRequiredAfterEvictingUIResources*

Review URL: https://codereview.chromium.org/176923007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253462 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
reveman@chromium.org committed Feb 26, 2014
1 parent 654e02e commit ad2e0ee
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
44 changes: 44 additions & 0 deletions cc/trees/layer_tree_host_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5041,4 +5041,48 @@ class LayerTreeHostTestSimpleSwapPromiseMonitor : public LayerTreeHostTest {

MULTI_THREAD_TEST_F(LayerTreeHostTestSimpleSwapPromiseMonitor);

class LayerTreeHostTestHighResRequiredAfterEvictingUIResources
: public LayerTreeHostTest {
protected:
virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE {
settings->impl_side_painting = true;
}

virtual void SetupTree() OVERRIDE {
LayerTreeHostTest::SetupTree();
ui_resource_ = FakeScopedUIResource::Create(layer_tree_host());
}

virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }

virtual void DidActivateTreeOnThread(LayerTreeHostImpl* host_impl) OVERRIDE {
host_impl->EvictAllUIResources();
// Existence of evicted UI resources will trigger NEW_CONTENT_TAKES_PRIORITY
// mode. Active tree should require high-res to draw after entering this
// mode to ensure that high-res tiles are also required for a pending tree
// to be activated.
EXPECT_TRUE(host_impl->active_tree()->RequiresHighResToDraw());
}

virtual void DidCommit() OVERRIDE {
int frame = layer_tree_host()->source_frame_number();
switch (frame) {
case 1:
PostSetNeedsCommitToMainThread();
break;
case 2:
ui_resource_.reset();
EndTest();
break;
}
}

virtual void AfterTest() OVERRIDE {}

FakeContentLayerClient client_;
scoped_ptr<FakeScopedUIResource> ui_resource_;
};

MULTI_THREAD_TEST_F(LayerTreeHostTestHighResRequiredAfterEvictingUIResources);

} // namespace cc
7 changes: 6 additions & 1 deletion cc/trees/thread_proxy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1656,8 +1656,13 @@ void ThreadProxy::RenewTreePriority() {
if (impl().layer_tree_host_impl->active_tree()->ContentsTexturesPurged() ||
impl().layer_tree_host_impl->active_tree()->ViewportSizeInvalid() ||
impl().layer_tree_host_impl->EvictedUIResourcesExist() ||
impl().input_throttled_until_commit)
impl().input_throttled_until_commit) {
// Once we enter NEW_CONTENTS_TAKES_PRIORITY mode, visible tiles on active
// tree might be freed. We need to set RequiresHighResToDraw to ensure that
// high res tiles will be required to activate pending tree.
impl().layer_tree_host_impl->active_tree()->SetRequiresHighResToDraw();
priority = NEW_CONTENT_TAKES_PRIORITY;
}

impl().layer_tree_host_impl->SetTreePriority(priority);
impl().scheduler->SetSmoothnessTakesPriority(priority ==
Expand Down

0 comments on commit ad2e0ee

Please sign in to comment.