summaryrefslogtreecommitdiffstats
path: root/cc/layers/picture_layer_impl_unittest.cc
diff options
context:
space:
mode:
authorreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 21:28:12 +0000
committerreveman@chromium.org <reveman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-27 21:28:12 +0000
commit8f802b2596f69ecd68ac6496da0e4b661183a777 (patch)
tree8dff0d63a3a8dabf11bb9ceb93daab88159aa50b /cc/layers/picture_layer_impl_unittest.cc
parentb9adabf3fd45ddbba723a7e78241df62c0cb730b (diff)
downloadchromium_src-8f802b2596f69ecd68ac6496da0e4b661183a777.zip
chromium_src-8f802b2596f69ecd68ac6496da0e4b661183a777.tar.gz
chromium_src-8f802b2596f69ecd68ac6496da0e4b661183a777.tar.bz2
Re-land: cc: Examine layers to determine if we're ready to activate.
This introduces a new mechanism for determining when we're ready to activate the pending tree. The tile priority is still used to determine when it's worth waking up the compositor thread and evaluating if we can activate. However, the actual check that determines if we're ready to activate doesn't rely on the state of scheduled raster tasks but is a synchronous call on each layer. The result is a pending tree activation mechanism that is much easier to debug and validate for correctness, while still providing the performance benefits of the old mechanism by taking the "required to activate" field of the tile priority into account when scheduling tasks. BUG=375206 TEST=cc_unittests --gtest_filter=PictureLayerImplTest.AllTilesRequiredForActivationAreReadyToDraw Review URL: https://codereview.chromium.org/287643004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@273040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/picture_layer_impl_unittest.cc')
-rw-r--r--cc/layers/picture_layer_impl_unittest.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/cc/layers/picture_layer_impl_unittest.cc b/cc/layers/picture_layer_impl_unittest.cc
index d919298..64454ae 100644
--- a/cc/layers/picture_layer_impl_unittest.cc
+++ b/cc/layers/picture_layer_impl_unittest.cc
@@ -2391,5 +2391,61 @@ TEST_F(PictureLayerImplTest, RasterScaleChangeWithoutAnimation) {
EXPECT_BOTH_EQ(HighResTiling()->contents_scale(), 1.f);
}
+TEST_F(PictureLayerImplTest, LowResReadyToDrawNotEnoughToActivate) {
+ 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();
+ active_layer_->SetAllTilesReady();
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // All pending layer tiles required are not ready.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // Initialize all low-res tiles.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->LowResTiling());
+
+ // Low-res tiles should not be enough.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // Initialize remaining tiles.
+ pending_layer_->SetAllTilesReady();
+
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
+TEST_F(PictureLayerImplTest, HighResReadyToDrawNotEnoughToActivate) {
+ 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();
+ active_layer_->SetAllTilesReady();
+ pending_layer_->MarkVisibleResourcesAsRequired();
+
+ // All pending layer tiles required are not ready.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // Initialize all high-res tiles.
+ pending_layer_->SetAllTilesReadyInTiling(pending_layer_->HighResTiling());
+
+ // High-res tiles should not be enough.
+ EXPECT_FALSE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+
+ // Initialize remaining tiles.
+ pending_layer_->SetAllTilesReady();
+
+ EXPECT_TRUE(pending_layer_->AllTilesRequiredForActivationAreReadyToDraw());
+}
+
} // namespace
} // namespace cc