Commit 1060805c authored by vmpstr@chromium.org's avatar vmpstr@chromium.org

cc: Set requires high res upon becoming visible

We should delay setting the flag that we require high res tiles to draw
until we become visible. The reason for this is that when invisible,
we could still activate which would cause us to reset the high res flag.
By delaying setting this until we're visible, we ensure that the flag
is active at the earliest time when we kick off the raster system again.

BUG=371624
R=enne, reveman

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@270209 0039d316-1c4b-4281-b951-d872f2087c98
parent b5e2a733
......@@ -1737,10 +1737,12 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
DidVisibilityChange(this, visible_);
EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy());
if (!visible_) {
// If we just became visible, we have to ensure that we draw high res tiles,
// to prevent checkerboard/low res flashes.
if (visible_)
active_tree()->SetRequiresHighResToDraw();
else
EvictAllUIResources();
}
// Evict tiles immediately if invisible since this tab may never get another
// draw or timer tick.
......
......@@ -5740,6 +5740,25 @@ TEST_F(LayerTreeHostImplTest, MemoryPolicy) {
EXPECT_EQ(nothing_cutoff_value, current_priority_cutoff_value_);
}
TEST_F(LayerTreeHostImplTest, RequireHighResWhenVisible) {
ASSERT_TRUE(host_impl_->active_tree());
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(false);
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(true);
EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(false);
EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->CreatePendingTree();
host_impl_->ActivatePendingTree();
EXPECT_FALSE(host_impl_->active_tree()->RequiresHighResToDraw());
host_impl_->SetVisible(true);
EXPECT_TRUE(host_impl_->active_tree()->RequiresHighResToDraw());
}
class LayerTreeHostImplTestManageTiles : public LayerTreeHostImplTest {
public:
virtual void SetUp() OVERRIDE {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment