summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj <danakj@chromium.org>2014-09-03 22:02:17 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-04 05:06:27 +0000
commitbc80fa3586c3a379c367972e22b97304632641b8 (patch)
tree3d9abdfd9be108991260f13bdb1207cba39254b2
parent2d514327ee39f1fecc5a993a7884bcb2b58dea0c (diff)
downloadchromium_src-bc80fa3586c3a379c367972e22b97304632641b8.zip
chromium_src-bc80fa3586c3a379c367972e22b97304632641b8.tar.gz
chromium_src-bc80fa3586c3a379c367972e22b97304632641b8.tar.bz2
cc: Don't require low res to activate for shared ready-to-draw tiles.
When a tile is shared (no invalidation) and is being drawn on the active tree (ready-to-draw), then that tile is not marked as required for activation since activating it can't cause a bad-resolution flash. However, we also would also say that "twin_had_missing_tile" in this scenario, which causes us to mark low-res tilings as required. But this is a bug since the tile is not missing in this case, and we do not need low res to fill it in. Instead, check to see if the active tree's tile is /not/ ready-to-draw. When that is the case, the active tile is not being drawn and is actually missing. Then a low res tile should be required if the active tree is showing a low res tile in the same place. For perf tests without scrolling (ie pages that just update in place without input), this fixes us to never require low res tiles to activate, since we won't show them. R=enne, vmpstr BUG=407121 Review URL: https://codereview.chromium.org/540663002 Cr-Commit-Position: refs/heads/master@{#293262}
-rw-r--r--cc/layers/picture_layer_impl.cc5
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc54
-rw-r--r--cc/test/fake_picture_layer_impl.cc12
-rw-r--r--cc/test/fake_picture_layer_impl.h1
4 files changed, 63 insertions, 9 deletions
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc
index 1f8e5a8..763f05e 100644
--- a/cc/layers/picture_layer_impl.cc
+++ b/cc/layers/picture_layer_impl.cc
@@ -936,7 +936,10 @@ bool PictureLayerImpl::MarkVisibleTilesAsRequired(
if (optional_twin_tiling) {
Tile* twin_tile = optional_twin_tiling->TileAt(iter.i(), iter.j());
if (!twin_tile || twin_tile == tile) {
- twin_had_missing_tile = true;
+ // However if the shared tile is being used on the active tree, then
+ // there's no missing content in this place, and low res is not needed.
+ if (!twin_tile || !twin_tile->IsReadyToDraw())
+ twin_had_missing_tile = true;
continue;
}
}
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index 249dcf0..ba6c6bb 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2822,7 +2822,7 @@ TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
}
-TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
+TEST_F(PictureLayerImplTest, HighResReadyToDrawEnoughToActivate) {
gfx::Size tile_size(100, 100);
gfx::Size layer_bounds(1000, 1000);
@@ -2841,12 +2841,58 @@ TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
// Initialize all high-res tiles.
pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
- // High-res tiles should not be enough.
+ // High-res tiles should be enough, since they cover everything visible.
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
+TEST_F(PictureLayerImplTest,
+ SharedActiveHighResReadyAndPendingLowResReadyNotEnoughToActivate) {
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(1000, 1000);
+
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
+
+ // Make sure some tiles are not shared.
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
+
+ CreateHighLowResAndSetAllTilesVisible();
+
+ // Initialize all high-res tiles in the active layer.
+ active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
+ // And all the low-res tiles in the pending layer.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
+
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // The unshared high-res tiles are not ready, so we cannot activate.
EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
- // Initialize remaining tiles.
- pending_layer_->SetAllTilesReady();
+ // When the unshared pending high-res tiles are ready, we can activate.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
+TEST_F(PictureLayerImplTest, SharedActiveHighResReadyNotEnoughToActivate) {
+ gfx::Size tile_size(100, 100);
+ gfx::Size layer_bounds(1000, 1000);
+
+ SetupDefaultTreesWithFixedTileSize(layer_bounds, tile_size);
+ // Make sure some tiles are not shared.
+ pending_layer_->set_invalidation(gfx::Rect(gfx::Point(50, 50), tile_size));
+
+ CreateHighLowResAndSetAllTilesVisible();
+
+ // Initialize all high-res tiles in the active layer.
+ active_layer_->SetAllTilesReadyInTiling(active_layer_->HighResTiling());
+
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // The unshared high-res tiles are not ready, so we cannot activate.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // When the unshared pending high-res tiles are ready, we can activate.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
}
diff --git a/cc/test/fake_picture_layer_impl.cc b/cc/test/fake_picture_layer_impl.cc
index 78924cd..98e0f6e 100644
--- a/cc/test/fake_picture_layer_impl.cc
+++ b/cc/test/fake_picture_layer_impl.cc
@@ -140,13 +140,17 @@ void FakePictureLayerImpl::SetAllTilesReadyInTiling(
std::vector<Tile*> tiles = tiling->AllTilesForTesting();
for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) {
Tile* tile = tiles[tile_idx];
- ManagedTileState& state = tile->managed_state();
- for (size_t mode_idx = 0; mode_idx < NUM_RASTER_MODES; ++mode_idx)
- state.tile_versions[mode_idx].SetSolidColorForTesting(true);
- DCHECK(tile->IsReadyToDraw());
+ SetTileReady(tile);
}
}
+void FakePictureLayerImpl::SetTileReady(Tile* tile) {
+ ManagedTileState& state = tile->managed_state();
+ for (size_t mode_idx = 0; mode_idx < NUM_RASTER_MODES; ++mode_idx)
+ state.tile_versions[mode_idx].SetSolidColorForTesting(true);
+ DCHECK(tile->IsReadyToDraw());
+}
+
void FakePictureLayerImpl::CreateDefaultTilingsAndTiles() {
layer_tree_impl()->UpdateDrawProperties();
diff --git a/cc/test/fake_picture_layer_impl.h b/cc/test/fake_picture_layer_impl.h
index 915b740..fbaecf7 100644
--- a/cc/test/fake_picture_layer_impl.h
+++ b/cc/test/fake_picture_layer_impl.h
@@ -108,6 +108,7 @@ class FakePictureLayerImpl : public PictureLayerImpl {
void SetAllTilesVisible();
void SetAllTilesReady();
void SetAllTilesReadyInTiling(PictureLayerTiling* tiling);
+ void SetTileReady(Tile* tile);
void ResetAllTilesPriorities();
PictureLayerTilingSet* GetTilings() { return tilings_.get(); }