Commit 7d351330 authored by vmpstr's avatar vmpstr Committed by Commit bot

cc: Remove recycled twin information from picture layer tiling set.

This patch cleans up some more recycled twin information. In particular,
it removes it from the picture layer tiling set. This makes it possible
to remove one of the functions that gets the recycled twin from the
layer.

R=enne, danakj

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

Cr-Commit-Position: refs/heads/master@{#330820}
parent 5c4a1bf3
......@@ -490,12 +490,6 @@ PictureLayerImpl* PictureLayerImpl::GetPendingOrActiveTwinLayer() const {
return twin_layer_;
}
PictureLayerImpl* PictureLayerImpl::GetRecycledTwinLayer() const {
if (!twin_layer_ || twin_layer_->IsOnActiveOrPendingTree())
return nullptr;
return twin_layer_;
}
void PictureLayerImpl::UpdateRasterSource(
scoped_refptr<RasterSource> raster_source,
Region* new_invalidation,
......@@ -1037,19 +1031,9 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
}
PictureLayerTilingSet* twin_set = twin ? twin->tilings_.get() : nullptr;
// TODO(vmpstr): See if this step is required without tile sharing.
PictureLayerImpl* recycled_twin = GetRecycledTwinLayer();
PictureLayerTilingSet* recycled_twin_set =
recycled_twin ? recycled_twin->tilings_.get() : nullptr;
tilings_->CleanUpTilings(min_acceptable_high_res_scale,
max_acceptable_high_res_scale, used_tilings,
layer_tree_impl()->create_low_res_tiling(), twin_set,
recycled_twin_set);
if (recycled_twin_set && recycled_twin_set->num_tilings() == 0)
recycled_twin->ResetRasterScale();
tilings_->CleanUpTilings(
min_acceptable_high_res_scale, max_acceptable_high_res_scale,
used_tilings, layer_tree_impl()->create_low_res_tiling(), twin_set);
DCHECK_GT(tilings_->num_tilings(), 0u);
SanityCheckTilingState();
}
......@@ -1117,10 +1101,6 @@ bool PictureLayerImpl::CanHaveTilings() const {
void PictureLayerImpl::SanityCheckTilingState() const {
#if DCHECK_IS_ON()
// Recycle tree doesn't have any restrictions.
if (layer_tree_impl()->IsRecycleTree())
return;
if (!CanHaveTilings()) {
DCHECK_EQ(0u, tilings_->num_tilings());
return;
......
......@@ -4602,33 +4602,6 @@ TEST_F(PictureLayerImplTest, PendingOrActiveTwinLayer) {
EXPECT_FALSE(active_layer_->GetPendingOrActiveTwinLayer());
}
TEST_F(PictureLayerImplTest, RecycledTwinLayer) {
gfx::Size tile_size(102, 102);
gfx::Size layer_bounds(1000, 1000);
scoped_refptr<FakePicturePileImpl> pile =
FakePicturePileImpl::CreateFilledPile(tile_size, layer_bounds);
SetupPendingTree(pile);
EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer());
ActivateTree();
EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
SetupPendingTree(pile);
EXPECT_FALSE(pending_layer_->GetRecycledTwinLayer());
EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
ActivateTree();
EXPECT_TRUE(active_layer_->GetRecycledTwinLayer());
EXPECT_EQ(old_pending_layer_, active_layer_->GetRecycledTwinLayer());
// Make an empty pending tree.
host_impl_.CreatePendingTree();
host_impl_.pending_tree()->DetachLayerTree();
EXPECT_FALSE(active_layer_->GetRecycledTwinLayer());
}
void PictureLayerImplTest::TestQuadsForSolidColor(bool test_for_solid) {
base::TimeTicks time_ticks;
time_ticks += base::TimeDelta::FromMilliseconds(1);
......
......@@ -194,8 +194,7 @@ void PictureLayerTilingSet::CleanUpTilings(
float max_acceptable_high_res_scale,
const std::vector<PictureLayerTiling*>& needed_tilings,
bool should_have_low_res,
PictureLayerTilingSet* twin_set,
PictureLayerTilingSet* recycled_twin_set) {
PictureLayerTilingSet* twin_set) {
float twin_low_res_scale = 0.f;
if (twin_set) {
PictureLayerTiling* tiling =
......@@ -229,15 +228,6 @@ void PictureLayerTilingSet::CleanUpTilings(
}
for (auto* tiling : to_remove) {
PictureLayerTiling* recycled_twin_tiling =
recycled_twin_set
? recycled_twin_set->FindTilingWithScale(tiling->contents_scale())
: nullptr;
// Remove the tiling from the recycle tree. Note that we ignore resolution,
// since we don't need to maintain high/low res on the recycle set.
if (recycled_twin_tiling)
recycled_twin_set->Remove(recycled_twin_tiling);
DCHECK_NE(HIGH_RESOLUTION, tiling->resolution());
Remove(tiling);
}
......
......@@ -52,8 +52,7 @@ class CC_EXPORT PictureLayerTilingSet {
float max_acceptable_high_res_scale,
const std::vector<PictureLayerTiling*>& needed_tilings,
bool should_have_low_res,
PictureLayerTilingSet* twin_set,
PictureLayerTilingSet* recycled_twin_set);
PictureLayerTilingSet* twin_set);
void RemoveNonIdealTilings();
// This function is called on the active tree during activation.
......
......@@ -107,24 +107,16 @@ class LayerTreeHostPictureTestTwinLayer
active_picture_impl->GetPendingOrActiveTwinLayer());
EXPECT_EQ(active_picture_impl,
pending_picture_impl->GetPendingOrActiveTwinLayer());
EXPECT_EQ(nullptr, active_picture_impl->GetRecycledTwinLayer());
}
void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override {
LayerImpl* active_root_impl = impl->active_tree()->root_layer();
LayerImpl* recycle_root_impl = impl->recycle_tree()->root_layer();
if (active_root_impl->children().empty()) {
EXPECT_EQ(2, activates_);
} else {
FakePictureLayerImpl* active_picture_impl =
static_cast<FakePictureLayerImpl*>(active_root_impl->children()[0]);
FakePictureLayerImpl* recycle_picture_impl =
static_cast<FakePictureLayerImpl*>(recycle_root_impl->children()[0]);
EXPECT_EQ(nullptr, active_picture_impl->GetPendingOrActiveTwinLayer());
EXPECT_EQ(recycle_picture_impl,
active_picture_impl->GetRecycledTwinLayer());
}
++activates_;
......@@ -228,13 +220,9 @@ class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree
LayerImpl* child = impl->active_tree()->root_layer()->children()[0];
FakePictureLayerImpl* picture_impl =
static_cast<FakePictureLayerImpl*>(child);
FakePictureLayerImpl* recycled_impl = static_cast<FakePictureLayerImpl*>(
picture_impl->GetRecycledTwinLayer());
switch (++frame_) {
case 1: {
PictureLayerTiling* tiling = picture_impl->HighResTiling();
PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
// There should be tiles at the top of the picture layer but not at the
......@@ -242,14 +230,6 @@ class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree
EXPECT_TRUE(tiling->TileAt(0, 0));
EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
// The recycled tiling has no tiles.
EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y));
// The live tiles rect matches on the recycled tree.
EXPECT_EQ(tiling->live_tiles_rect(),
recycled_tiling->live_tiles_rect());
// Make the bottom of the layer visible.
picture_impl->SetPosition(gfx::PointF(0.f, -100000.f + 100.f));
impl->SetNeedsRedraw();
......@@ -257,15 +237,10 @@ class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree
}
case 2: {
PictureLayerTiling* tiling = picture_impl->HighResTiling();
PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
// There not be tiles at the top of the layer now.
EXPECT_FALSE(tiling->TileAt(0, 0));
// The recycled twin tiling should not have unshared tiles at the top
// either.
EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
// Make the top of the layer visible again.
picture_impl->SetPosition(gfx::PointF());
impl->SetNeedsRedraw();
......@@ -273,21 +248,12 @@ class LayerTreeHostPictureTestChangeLiveTilesRectWithRecycleTree
}
case 3: {
PictureLayerTiling* tiling = picture_impl->HighResTiling();
PictureLayerTiling* recycled_tiling = recycled_impl->HighResTiling();
int num_tiles_y = tiling->TilingDataForTesting().num_tiles_y();
// There should be tiles at the top of the picture layer again.
EXPECT_TRUE(tiling->TileAt(0, 0));
EXPECT_FALSE(tiling->TileAt(0, num_tiles_y));
// The recycled tiling should have no tiles.
EXPECT_FALSE(recycled_tiling->TileAt(0, 0));
EXPECT_FALSE(recycled_tiling->TileAt(0, num_tiles_y));
// The live tiles rect matches on the recycled tree.
EXPECT_EQ(tiling->live_tiles_rect(),
recycled_tiling->live_tiles_rect());
// Make a new main frame without changing the picture layer at all, so
// it won't need to update or push properties.
did_post_commit_ = true;
......
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