Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(846)

Unified Diff: cc/trees/layer_tree_impl_unittest.cc

Issue 819643004: Cache viewport rect for tile priority in UpdateTiles (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/trees/layer_tree_impl.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl_unittest.cc
diff --git a/cc/trees/layer_tree_impl_unittest.cc b/cc/trees/layer_tree_impl_unittest.cc
index 2c5dd05be0372135e4c84b3acdd4d16f95993761..c50cb5cec8c20256b30c036b2defdda548c5d18a 100644
--- a/cc/trees/layer_tree_impl_unittest.cc
+++ b/cc/trees/layer_tree_impl_unittest.cc
@@ -2093,5 +2093,44 @@ TEST_F(LayerTreeImplTest, NumLayersSmallTree) {
EXPECT_EQ(4u, host_impl().active_tree()->NumLayers());
}
+TEST_F(LayerTreeImplTest, ViewportRectForTilePriorityIsCached) {
+ bool resourceless_software_draw = false;
+
+ gfx::Transform transform, transform_for_tile_priority;
+ gfx::Point3F transform_origin;
+ gfx::PointF position;
+ gfx::Size bounds(100, 100);
+ gfx::Rect viewport = gfx::Rect(0, 0, 200, 200),
+ rect1 = gfx::Rect(0, 0, 100, 100),
+ rect2 = gfx::Rect(10, 10, 123, 123);
+
+ scoped_ptr<LayerImpl> root = LayerImpl::Create(host_impl().active_tree(), 1);
+ SetLayerPropertiesForTesting(root.get(), transform, transform_origin,
+ position, bounds, true, false, true);
+ root->SetDrawsContent(true);
+ host_impl().SetViewportSize(root->bounds());
+ host_impl().active_tree()->SetRootLayer(root.Pass());
+ host_impl().UpdateNumChildrenAndDrawPropertiesForActiveTree();
+
+ host_impl().SetExternalDrawConstraints(
+ transform, viewport, viewport,
+ rect1, /* viewport_rect_for_tile_priority */
+ transform_for_tile_priority, resourceless_software_draw);
+ host_impl().active_tree()->UpdateDrawProperties();
+ EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1);
+
+ host_impl().SetExternalDrawConstraints(
+ transform, viewport, viewport,
+ rect2, /* viewport_rect_for_tile_priority */
+ transform_for_tile_priority, resourceless_software_draw);
+
+ // Test that even when the LTH's viewport rect for tile priority has
+ // changed, the ViewportRectForTilePriority will not change to most recent
+ // value until UpdateDrawProperties is called.
+ EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect1);
+ host_impl().active_tree()->UpdateDrawProperties();
+ EXPECT_EQ(host_impl().active_tree()->ViewportRectForTilePriority(), rect2);
+}
+
} // namespace
} // namespace cc
« cc/trees/layer_tree_impl.cc ('K') | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698