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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 01aae1488bd948e1a41cd4e58729bd7b9b1d12a4..4b1817ef0e09b45cc92210b3e88a5ce78ffd5be6 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -3104,14 +3104,18 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
case 6:
child_->RemoveFromParent();
// No layers need commit.
+ ++expected_push_properties_root_;
break;
case 7:
root_->AddChild(child_);
// Layers added to the tree get committed.
++expected_push_properties_child_;
++expected_push_properties_grandchild_;
+ ++expected_push_properties_root_;
break;
case 8:
+ ++expected_push_properties_root_;
+ ++expected_push_properties_child_;
grandchild_->RemoveFromParent();
// No layers need commit.
break;
@@ -3119,6 +3123,8 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
child_->AddChild(grandchild_);
// Layers added to the tree get committed.
++expected_push_properties_grandchild_;
+ ++expected_push_properties_root_;
+ ++expected_push_properties_child_;
break;
case 10:
layer_tree_host()->SetViewportSize(gfx::Size(20, 20));
@@ -3144,6 +3150,7 @@ class LayerTreeHostTestLayersPushProperties : public LayerTreeHostTest {
// Layers added to the tree get committed.
++expected_push_properties_child_;
++expected_push_properties_grandchild_;
+ ++expected_push_properties_root_;
break;
case 15:
grandchild_->SetPosition(gfx::Point(1, 1));
@@ -3256,6 +3263,7 @@ class LayerTreeHostTestImplLayersPushProperties
// grandchild_impl is now the leaf that always pushes. It is pushed.
++expected_push_properties_grandchild_impl_;
+ ++expected_push_properties_root_impl_;
break;
case 7:
// The leaf that always pushes is pushed.
@@ -3264,6 +3272,7 @@ class LayerTreeHostTestImplLayersPushProperties
// Child is added back. New layers are initialized.
++expected_push_properties_grandchild2_impl_;
++expected_push_properties_child2_impl_;
+ ++expected_push_properties_root_impl_;
break;
case 8:
// Leaf is removed.
@@ -3271,6 +3280,8 @@ class LayerTreeHostTestImplLayersPushProperties
// Always pushing.
++expected_push_properties_grandchild_impl_;
+ ++expected_push_properties_child2_impl_;
+ ++expected_push_properties_root_impl_;
break;
case 9:
// Leaf is added back
@@ -3278,6 +3289,8 @@ class LayerTreeHostTestImplLayersPushProperties
// The leaf that always pushes is pushed.
++expected_push_properties_grandchild_impl_;
+ ++expected_push_properties_root_impl_;
+ ++expected_push_properties_child2_impl_;
break;
case 10:
// The leaf that always pushes is pushed.
@@ -3312,6 +3325,7 @@ class LayerTreeHostTestImplLayersPushProperties
++expected_push_properties_child2_impl_;
++expected_push_properties_grandchild2_impl_;
+ ++expected_push_properties_root_impl_;
break;
case 15:
// The position of this child was changed.
@@ -3551,9 +3565,9 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
grandchild1_->RemoveFromParent();
grandchild1_->SetPosition(gfx::Point(1, 1));
- EXPECT_FALSE(root_->needs_push_properties());
- EXPECT_FALSE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->descendant_needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
EXPECT_FALSE(grandchild2_->needs_push_properties());
EXPECT_FALSE(grandchild2_->descendant_needs_push_properties());
@@ -3562,9 +3576,9 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
child_->AddChild(grandchild1_);
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
EXPECT_TRUE(grandchild1_->needs_push_properties());
EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
@@ -3575,9 +3589,9 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
grandchild2_->SetPosition(gfx::Point(1, 1));
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
EXPECT_TRUE(grandchild1_->needs_push_properties());
EXPECT_FALSE(grandchild1_->descendant_needs_push_properties());
@@ -3589,18 +3603,18 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion
// grandchild2_ will still need a push properties.
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
// grandchild3_ does not need a push properties, so recursing should
// no longer be needed.
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
- EXPECT_FALSE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->descendant_needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
EndTest();
break;
@@ -3636,18 +3650,19 @@ class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence
// grandchild2_ will still need a push properties.
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ // We will need push properties because our drawable children changed
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
// grandchild3_ does not need a push properties, so recursing should
// no longer be needed.
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
- EXPECT_FALSE(root_->descendant_needs_push_properties());
- EXPECT_FALSE(child_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->descendant_needs_push_properties());
+ EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
EndTest();
break;
@@ -3685,7 +3700,7 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
grandchild2_->SetPosition(gfx::Point(1, 1));
root_->AddChild(child_);
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
@@ -3698,21 +3713,21 @@ class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
grandchild3_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
@@ -3764,21 +3779,21 @@ class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
child_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_FALSE(root_->descendant_needs_push_properties());
EndTest();
@@ -3828,21 +3843,21 @@ class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent
grandchild1_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_TRUE(child_->descendant_needs_push_properties());
grandchild2_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_TRUE(root_->descendant_needs_push_properties());
EXPECT_TRUE(child_->needs_push_properties());
EXPECT_FALSE(child_->descendant_needs_push_properties());
child_->RemoveFromParent();
- EXPECT_FALSE(root_->needs_push_properties());
+ EXPECT_TRUE(root_->needs_push_properties());
EXPECT_FALSE(root_->descendant_needs_push_properties());
EndTest();

Powered by Google App Engine
This is Rietveld 408576698