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

Unified Diff: cc/blimp/layer_tree_host_remote_unittest.cc

Issue 2467043002: cc/blimp: Eliminate Layer updates for common cases. (Closed)
Patch Set: tests Created 4 years, 1 month 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
« no previous file with comments | « cc/blimp/layer_tree_host_remote.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blimp/layer_tree_host_remote_unittest.cc
diff --git a/cc/blimp/layer_tree_host_remote_unittest.cc b/cc/blimp/layer_tree_host_remote_unittest.cc
index 8cd6d6d439db2426ab6048250d5deecd98a415aa..08f2bf6d6b68a42f553c3205cc5f66657b5b4f28 100644
--- a/cc/blimp/layer_tree_host_remote_unittest.cc
+++ b/cc/blimp/layer_tree_host_remote_unittest.cc
@@ -413,5 +413,42 @@ TEST_F(LayerTreeHostRemoteTest, ScrollAndScaleSync) {
EXPECT_FALSE(updates_applied);
}
+TEST_F(LayerTreeHostRemoteTest, IdentifiedLayersToSkipUpdates) {
+ EXPECT_BEGIN_MAIN_FRAME_AND_COMMIT(mock_layer_tree_host_client_, 1);
+
+ scoped_refptr<MockLayer> non_drawable_layer = new MockLayer(true);
+ non_drawable_layer->SetIsDrawable(false);
+ non_drawable_layer->SetBounds(gfx::Size(5, 5));
+
+ scoped_refptr<MockLayer> empty_bound_layer = new MockLayer(true);
ajuma 2016/11/01 21:37:07 nit: empty_bounds_layer
+ empty_bound_layer->SetIsDrawable(true);
+ empty_bound_layer->SetBounds(gfx::Size());
+
+ scoped_refptr<MockLayer> transparent_layer = new MockLayer(true);
+ transparent_layer->SetIsDrawable(true);
+ transparent_layer->SetBounds(gfx::Size(5, 5));
+ transparent_layer->SetOpacity(0.f);
+
+ scoped_refptr<MockLayer> updated_layer = new MockLayer(true);
+ updated_layer->SetIsDrawable(true);
+ updated_layer->SetBounds(gfx::Size(5, 5));
+
+ root_layer_->AddChild(non_drawable_layer);
+ root_layer_->AddChild(empty_bound_layer);
+ empty_bound_layer->SetMaskLayer(transparent_layer.get());
+ empty_bound_layer->AddChild(updated_layer);
+ DCHECK(updated_layer->GetLayerTreeHostForTesting());
+
+ // Commit and serialize.
+ layer_tree_host_->SetNeedsCommit();
+ base::RunLoop().RunUntilIdle();
+
+ // Only the updated_layer should have been updated.
+ EXPECT_FALSE(non_drawable_layer->did_update());
+ EXPECT_FALSE(empty_bound_layer->did_update());
+ EXPECT_FALSE(transparent_layer->did_update());
+ EXPECT_TRUE(updated_layer->did_update());
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/blimp/layer_tree_host_remote.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698