| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2743 class PushPropertiesCountingLayer : public Layer { | 2743 class PushPropertiesCountingLayer : public Layer { |
| 2744 public: | 2744 public: |
| 2745 static scoped_refptr<PushPropertiesCountingLayer> Create( | 2745 static scoped_refptr<PushPropertiesCountingLayer> Create( |
| 2746 const LayerSettings& settings) { | 2746 const LayerSettings& settings) { |
| 2747 return new PushPropertiesCountingLayer(settings); | 2747 return new PushPropertiesCountingLayer(settings); |
| 2748 } | 2748 } |
| 2749 | 2749 |
| 2750 void PushPropertiesTo(LayerImpl* layer) override { | 2750 void PushPropertiesTo(LayerImpl* layer) override { |
| 2751 Layer::PushPropertiesTo(layer); | 2751 Layer::PushPropertiesTo(layer); |
| 2752 push_properties_count_++; | 2752 push_properties_count_++; |
| 2753 if (persist_needs_push_properties_) | 2753 if (persist_needs_push_properties_) { |
| 2754 needs_push_properties_ = true; | 2754 layer_tree_host()->AddLayerShouldPushProperties(this); |
| 2755 } |
| 2755 } | 2756 } |
| 2756 | 2757 |
| 2757 // Something to make this layer push properties, but no other layer. | 2758 // Something to make this layer push properties, but no other layer. |
| 2758 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } | 2759 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } |
| 2759 | 2760 |
| 2760 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { | 2761 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override { |
| 2761 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); | 2762 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); |
| 2762 } | 2763 } |
| 2763 | 2764 |
| 2764 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } | 2765 void SetDrawsContent(bool draws_content) { SetIsDrawable(draws_content); } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 other_root_->push_properties_count()) | 2833 other_root_->push_properties_count()) |
| 2833 << "num_commits: " << num_commits_; | 2834 << "num_commits: " << num_commits_; |
| 2834 EXPECT_EQ(expected_push_properties_leaf_layer_, | 2835 EXPECT_EQ(expected_push_properties_leaf_layer_, |
| 2835 leaf_always_pushing_layer_->push_properties_count()) | 2836 leaf_always_pushing_layer_->push_properties_count()) |
| 2836 << "num_commits: " << num_commits_; | 2837 << "num_commits: " << num_commits_; |
| 2837 | 2838 |
| 2838 ++num_commits_; | 2839 ++num_commits_; |
| 2839 | 2840 |
| 2840 // The scrollbar layer always needs to be pushed. | 2841 // The scrollbar layer always needs to be pushed. |
| 2841 if (root_->layer_tree_host()) { | 2842 if (root_->layer_tree_host()) { |
| 2842 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 2843 EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 2843 EXPECT_FALSE(root_->needs_push_properties()); | 2844 root_.get())); |
| 2844 } | 2845 } |
| 2845 if (child2_->layer_tree_host()) { | 2846 if (child2_->layer_tree_host()) { |
| 2846 EXPECT_TRUE(child2_->descendant_needs_push_properties()); | 2847 EXPECT_FALSE( |
| 2847 EXPECT_FALSE(child2_->needs_push_properties()); | 2848 child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 2849 child2_.get())); |
| 2848 } | 2850 } |
| 2849 if (leaf_always_pushing_layer_->layer_tree_host()) { | 2851 if (leaf_always_pushing_layer_->layer_tree_host()) { |
| 2850 EXPECT_FALSE( | 2852 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() |
| 2851 leaf_always_pushing_layer_->descendant_needs_push_properties()); | 2853 ->LayerNeedsPushPropertiesForTesting( |
| 2852 EXPECT_TRUE(leaf_always_pushing_layer_->needs_push_properties()); | 2854 leaf_always_pushing_layer_.get())); |
| 2853 } | 2855 } |
| 2854 | 2856 |
| 2855 // child_ and grandchild_ don't persist their need to push properties. | 2857 // child_ and grandchild_ don't persist their need to push properties. |
| 2856 if (child_->layer_tree_host()) { | 2858 if (child_->layer_tree_host()) { |
| 2857 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 2859 EXPECT_FALSE( |
| 2858 EXPECT_FALSE(child_->needs_push_properties()); | 2860 child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 2861 child_.get())); |
| 2859 } | 2862 } |
| 2860 if (grandchild_->layer_tree_host()) { | 2863 if (grandchild_->layer_tree_host()) { |
| 2861 EXPECT_FALSE(grandchild_->descendant_needs_push_properties()); | 2864 EXPECT_FALSE( |
| 2862 EXPECT_FALSE(grandchild_->needs_push_properties()); | 2865 grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 2866 grandchild_.get())); |
| 2863 } | 2867 } |
| 2864 | 2868 |
| 2865 if (other_root_->layer_tree_host()) { | 2869 if (other_root_->layer_tree_host()) { |
| 2866 EXPECT_FALSE(other_root_->descendant_needs_push_properties()); | 2870 EXPECT_FALSE( |
| 2867 EXPECT_FALSE(other_root_->needs_push_properties()); | 2871 other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 2872 other_root_.get())); |
| 2868 } | 2873 } |
| 2869 | 2874 |
| 2870 switch (num_commits_) { | 2875 switch (num_commits_) { |
| 2871 case 1: | 2876 case 1: |
| 2872 layer_tree_host()->SetRootLayer(root_); | 2877 layer_tree_host()->SetRootLayer(root_); |
| 2873 // Layers added to the tree get committed. | 2878 // Layers added to the tree get committed. |
| 2874 ++expected_push_properties_root_; | 2879 ++expected_push_properties_root_; |
| 2875 ++expected_push_properties_child_; | 2880 ++expected_push_properties_child_; |
| 2876 ++expected_push_properties_grandchild_; | 2881 ++expected_push_properties_grandchild_; |
| 2877 ++expected_push_properties_child2_; | 2882 ++expected_push_properties_child2_; |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3212 case 1: { | 3217 case 1: { |
| 3213 // During update, the ignore_set_needs_commit_ bit is set to true to | 3218 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3214 // avoid causing a second commit to be scheduled. If a property change | 3219 // avoid causing a second commit to be scheduled. If a property change |
| 3215 // is made during this, however, it needs to be pushed in the upcoming | 3220 // is made during this, however, it needs to be pushed in the upcoming |
| 3216 // commit. | 3221 // commit. |
| 3217 scoped_ptr<base::AutoReset<bool>> ignore = | 3222 scoped_ptr<base::AutoReset<bool>> ignore = |
| 3218 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3223 scrollbar_layer_->IgnoreSetNeedsCommit(); |
| 3219 | 3224 |
| 3220 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3225 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
| 3221 | 3226 |
| 3222 EXPECT_TRUE(scrollbar_layer_->needs_push_properties()); | 3227 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3223 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3228 scrollbar_layer_.get())); |
| 3224 layer_tree_host()->SetNeedsCommit(); | 3229 layer_tree_host()->SetNeedsCommit(); |
| 3225 | 3230 |
| 3226 scrollbar_layer_->reset_push_properties_count(); | 3231 scrollbar_layer_->reset_push_properties_count(); |
| 3227 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3232 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
| 3228 break; | 3233 break; |
| 3229 } | 3234 } |
| 3230 case 2: | 3235 case 2: |
| 3231 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3236 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
| 3232 EndTest(); | 3237 EndTest(); |
| 3233 break; | 3238 break; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3257 | 3262 |
| 3258 void DidCommitAndDrawFrame() override { | 3263 void DidCommitAndDrawFrame() override { |
| 3259 switch (layer_tree_host()->source_frame_number()) { | 3264 switch (layer_tree_host()->source_frame_number()) { |
| 3260 case 0: | 3265 case 0: |
| 3261 break; | 3266 break; |
| 3262 case 1: { | 3267 case 1: { |
| 3263 // During update, the ignore_set_needs_commit_ bit is set to true to | 3268 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3264 // avoid causing a second commit to be scheduled. If a property change | 3269 // avoid causing a second commit to be scheduled. If a property change |
| 3265 // is made during this, however, it needs to be pushed in the upcoming | 3270 // is made during this, however, it needs to be pushed in the upcoming |
| 3266 // commit. | 3271 // commit. |
| 3267 EXPECT_FALSE(root_->needs_push_properties()); | 3272 EXPECT_FALSE( |
| 3268 EXPECT_FALSE(child_->needs_push_properties()); | 3273 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3274 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3275 child_.get())); |
| 3269 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3276 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
| 3270 root_->reset_push_properties_count(); | 3277 root_->reset_push_properties_count(); |
| 3271 child_->reset_push_properties_count(); | 3278 child_->reset_push_properties_count(); |
| 3272 child_->SetDrawsContent(true); | 3279 child_->SetDrawsContent(true); |
| 3273 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3280 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
| 3274 EXPECT_EQ(0u, root_->push_properties_count()); | 3281 EXPECT_EQ(0u, root_->push_properties_count()); |
| 3275 EXPECT_EQ(0u, child_->push_properties_count()); | 3282 EXPECT_EQ(0u, child_->push_properties_count()); |
| 3276 EXPECT_TRUE(root_->needs_push_properties()); | 3283 EXPECT_TRUE( |
| 3277 EXPECT_TRUE(child_->needs_push_properties()); | 3284 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3285 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3286 child_.get())); |
| 3278 break; | 3287 break; |
| 3279 } | 3288 } |
| 3280 case 2: | 3289 case 2: |
| 3281 EXPECT_EQ(1u, root_->push_properties_count()); | 3290 EXPECT_EQ(1u, root_->push_properties_count()); |
| 3282 EXPECT_EQ(1u, child_->push_properties_count()); | 3291 EXPECT_EQ(1u, child_->push_properties_count()); |
| 3283 EXPECT_FALSE(root_->needs_push_properties()); | 3292 EXPECT_FALSE( |
| 3284 EXPECT_FALSE(child_->needs_push_properties()); | 3293 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3294 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3295 child_.get())); |
| 3285 EndTest(); | 3296 EndTest(); |
| 3286 break; | 3297 break; |
| 3287 } | 3298 } |
| 3288 } | 3299 } |
| 3289 | 3300 |
| 3290 void AfterTest() override {} | 3301 void AfterTest() override {} |
| 3291 | 3302 |
| 3292 scoped_refptr<PushPropertiesCountingLayer> root_; | 3303 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3293 scoped_refptr<PushPropertiesCountingLayer> child_; | 3304 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3294 }; | 3305 }; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3339 size_t expected_push_properties_grandchild3_; | 3350 size_t expected_push_properties_grandchild3_; |
| 3340 }; | 3351 }; |
| 3341 | 3352 |
| 3342 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3353 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3343 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3354 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3344 protected: | 3355 protected: |
| 3345 void DidCommitAndDrawFrame() override { | 3356 void DidCommitAndDrawFrame() override { |
| 3346 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3357 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3347 switch (last_source_frame_number) { | 3358 switch (last_source_frame_number) { |
| 3348 case 0: | 3359 case 0: |
| 3349 // All layers except root will need push properties as they are added | 3360 // All layers will need push properties as we set their layer tree host |
| 3350 // as a child to some other layer which changes their stacking order. | |
| 3351 EXPECT_FALSE(root_->needs_push_properties()); | |
| 3352 EXPECT_TRUE(root_->descendant_needs_push_properties()); | |
| 3353 EXPECT_TRUE(child_->needs_push_properties()); | |
| 3354 EXPECT_TRUE(child_->descendant_needs_push_properties()); | |
| 3355 EXPECT_TRUE(grandchild1_->needs_push_properties()); | |
| 3356 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | |
| 3357 EXPECT_TRUE(grandchild2_->needs_push_properties()); | |
| 3358 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | |
| 3359 EXPECT_TRUE(grandchild3_->needs_push_properties()); | |
| 3360 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | |
| 3361 | |
| 3362 layer_tree_host()->SetRootLayer(root_); | 3361 layer_tree_host()->SetRootLayer(root_); |
| 3363 | 3362 EXPECT_TRUE( |
| 3364 // Now, even the root will need to push properties. | 3363 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3365 EXPECT_TRUE(root_->needs_push_properties()); | 3364 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3366 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3365 child_.get())); |
| 3366 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3367 grandchild1_.get())); |
| 3368 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3369 grandchild2_.get())); |
| 3370 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3371 grandchild3_.get())); |
| 3367 break; | 3372 break; |
| 3368 case 1: | 3373 case 1: |
| 3369 EndTest(); | 3374 EndTest(); |
| 3370 break; | 3375 break; |
| 3371 } | 3376 } |
| 3372 } | 3377 } |
| 3373 }; | 3378 }; |
| 3374 | 3379 |
| 3375 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3380 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3376 | 3381 |
| 3377 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3382 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3378 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3383 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3379 protected: | 3384 protected: |
| 3380 void DidCommitAndDrawFrame() override { | 3385 void DidCommitAndDrawFrame() override { |
| 3381 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3386 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3382 switch (last_source_frame_number) { | 3387 switch (last_source_frame_number) { |
| 3383 case 0: | 3388 case 0: |
| 3384 layer_tree_host()->SetRootLayer(root_); | 3389 layer_tree_host()->SetRootLayer(root_); |
| 3385 break; | 3390 break; |
| 3386 case 1: | 3391 case 1: |
| 3387 EXPECT_FALSE(root_->needs_push_properties()); | 3392 EXPECT_FALSE( |
| 3388 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3393 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3389 EXPECT_FALSE(child_->needs_push_properties()); | 3394 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3390 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3395 child_.get())); |
| 3391 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3396 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3392 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3397 grandchild1_.get())); |
| 3393 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3398 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3394 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3399 grandchild2_.get())); |
| 3395 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3400 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3396 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3401 grandchild3_.get())); |
| 3397 | 3402 |
| 3398 grandchild1_->RemoveFromParent(); | 3403 grandchild1_->RemoveFromParent(); |
| 3399 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3404 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3400 | 3405 |
| 3401 EXPECT_FALSE(root_->needs_push_properties()); | 3406 EXPECT_FALSE( |
| 3402 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3407 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3403 EXPECT_FALSE(child_->needs_push_properties()); | 3408 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3404 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3409 child_.get())); |
| 3405 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3410 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3406 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3411 grandchild2_.get())); |
| 3407 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3412 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3408 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3413 grandchild3_.get())); |
| 3409 | 3414 |
| 3410 child_->AddChild(grandchild1_); | 3415 child_->AddChild(grandchild1_); |
| 3411 | 3416 |
| 3412 EXPECT_FALSE(root_->needs_push_properties()); | 3417 EXPECT_FALSE( |
| 3413 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3418 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3414 EXPECT_FALSE(child_->needs_push_properties()); | 3419 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3415 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3420 child_.get())); |
| 3416 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3421 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3417 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3422 grandchild1_.get())); |
| 3418 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3423 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3419 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3424 grandchild2_.get())); |
| 3420 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3425 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3421 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3426 grandchild3_.get())); |
| 3422 | 3427 |
| 3423 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3428 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3424 | 3429 |
| 3425 EXPECT_FALSE(root_->needs_push_properties()); | 3430 EXPECT_FALSE( |
| 3426 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3431 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3427 EXPECT_FALSE(child_->needs_push_properties()); | 3432 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3428 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3433 child_.get())); |
| 3429 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3434 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3430 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3435 grandchild1_.get())); |
| 3431 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3436 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3432 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3437 grandchild2_.get())); |
| 3433 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3438 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3434 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3439 grandchild3_.get())); |
| 3435 | 3440 |
| 3436 // grandchild2_ will still need a push properties. | 3441 // grandchild2_ will still need a push properties. |
| 3437 grandchild1_->RemoveFromParent(); | 3442 grandchild1_->RemoveFromParent(); |
| 3438 | 3443 |
| 3439 EXPECT_FALSE(root_->needs_push_properties()); | 3444 EXPECT_FALSE( |
| 3440 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3445 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3441 EXPECT_FALSE(child_->needs_push_properties()); | 3446 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3442 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3447 child_.get())); |
| 3443 | 3448 |
| 3444 // grandchild3_ does not need a push properties, so recursing should | 3449 // grandchild3_ does not need a push properties, so recursing should |
| 3445 // no longer be needed. | 3450 // no longer be needed. |
| 3446 grandchild2_->RemoveFromParent(); | 3451 grandchild2_->RemoveFromParent(); |
| 3447 | 3452 |
| 3448 EXPECT_FALSE(root_->needs_push_properties()); | 3453 EXPECT_FALSE( |
| 3449 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3454 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3450 EXPECT_FALSE(child_->needs_push_properties()); | 3455 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3451 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3456 child_.get())); |
| 3452 EndTest(); | 3457 EndTest(); |
| 3453 break; | 3458 break; |
| 3454 } | 3459 } |
| 3455 } | 3460 } |
| 3456 }; | 3461 }; |
| 3457 | 3462 |
| 3458 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3463 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 3459 | 3464 |
| 3460 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3465 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 3461 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3466 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3462 protected: | 3467 protected: |
| 3463 void DidCommitAndDrawFrame() override { | 3468 void DidCommitAndDrawFrame() override { |
| 3464 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3469 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3465 switch (last_source_frame_number) { | 3470 switch (last_source_frame_number) { |
| 3466 case 0: | 3471 case 0: |
| 3467 layer_tree_host()->SetRootLayer(root_); | 3472 layer_tree_host()->SetRootLayer(root_); |
| 3468 grandchild1_->set_persist_needs_push_properties(true); | 3473 grandchild1_->set_persist_needs_push_properties(true); |
| 3469 grandchild2_->set_persist_needs_push_properties(true); | 3474 grandchild2_->set_persist_needs_push_properties(true); |
| 3470 break; | 3475 break; |
| 3471 case 1: | 3476 case 1: |
| 3472 EXPECT_FALSE(root_->needs_push_properties()); | 3477 EXPECT_FALSE( |
| 3473 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3478 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3474 EXPECT_FALSE(child_->needs_push_properties()); | 3479 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3475 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3480 child_.get())); |
| 3476 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3481 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3477 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3482 grandchild1_.get())); |
| 3478 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3483 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3479 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3484 grandchild2_.get())); |
| 3480 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3485 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3481 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3486 grandchild3_.get())); |
| 3482 | 3487 |
| 3483 // grandchild2_ will still need a push properties. | 3488 // grandchild2_ will still need a push properties. |
| 3484 grandchild1_->RemoveFromParent(); | 3489 grandchild1_->RemoveFromParent(); |
| 3485 | 3490 |
| 3486 EXPECT_FALSE(root_->needs_push_properties()); | 3491 EXPECT_FALSE( |
| 3487 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3492 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3488 EXPECT_FALSE(child_->needs_push_properties()); | 3493 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3489 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3494 child_.get())); |
| 3490 | 3495 |
| 3491 // grandchild3_ does not need a push properties, so recursing should | 3496 // grandchild3_ does not need a push properties, so recursing should |
| 3492 // no longer be needed. | 3497 // no longer be needed. |
| 3493 grandchild2_->RemoveFromParent(); | 3498 grandchild2_->RemoveFromParent(); |
| 3494 | 3499 |
| 3495 EXPECT_FALSE(root_->needs_push_properties()); | 3500 EXPECT_FALSE( |
| 3496 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3501 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3497 EXPECT_FALSE(child_->needs_push_properties()); | 3502 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3498 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3503 child_.get())); |
| 3499 EndTest(); | 3504 EndTest(); |
| 3500 break; | 3505 break; |
| 3501 } | 3506 } |
| 3502 } | 3507 } |
| 3503 }; | 3508 }; |
| 3504 | 3509 |
| 3505 MULTI_THREAD_TEST_F( | 3510 MULTI_THREAD_TEST_F( |
| 3506 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3511 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 3507 | 3512 |
| 3508 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3513 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 3509 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3514 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3510 protected: | 3515 protected: |
| 3511 void DidCommitAndDrawFrame() override { | 3516 void DidCommitAndDrawFrame() override { |
| 3512 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3517 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3513 switch (last_source_frame_number) { | 3518 switch (last_source_frame_number) { |
| 3514 case 0: | 3519 case 0: |
| 3515 layer_tree_host()->SetRootLayer(root_); | 3520 layer_tree_host()->SetRootLayer(root_); |
| 3516 break; | 3521 break; |
| 3517 case 1: | 3522 case 1: |
| 3518 EXPECT_FALSE(root_->needs_push_properties()); | 3523 EXPECT_FALSE( |
| 3519 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3524 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3520 EXPECT_FALSE(child_->needs_push_properties()); | 3525 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3521 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3526 child_.get())); |
| 3522 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3527 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3523 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3528 grandchild1_.get())); |
| 3524 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3529 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3525 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3530 grandchild2_.get())); |
| 3526 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3531 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3527 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3532 grandchild3_.get())); |
| 3528 | 3533 |
| 3529 // Change grandchildren while their parent is not in the tree. | 3534 // Change grandchildren while their parent is not in the tree. |
| 3530 child_->RemoveFromParent(); | 3535 child_->RemoveFromParent(); |
| 3531 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3536 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3532 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3537 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3533 root_->AddChild(child_); | 3538 root_->AddChild(child_); |
| 3534 | 3539 |
| 3535 EXPECT_FALSE(root_->needs_push_properties()); | 3540 EXPECT_FALSE( |
| 3536 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3541 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3537 EXPECT_TRUE(child_->needs_push_properties()); | 3542 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3538 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3543 child_.get())); |
| 3539 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3544 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3540 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3545 grandchild1_.get())); |
| 3541 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3546 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3542 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3547 grandchild2_.get())); |
| 3543 EXPECT_TRUE(grandchild3_->needs_push_properties()); | 3548 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3544 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3549 grandchild3_.get())); |
| 3545 | 3550 |
| 3546 grandchild1_->RemoveFromParent(); | 3551 grandchild1_->RemoveFromParent(); |
| 3547 | 3552 |
| 3548 EXPECT_FALSE(root_->needs_push_properties()); | 3553 EXPECT_FALSE( |
| 3549 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3554 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3550 EXPECT_TRUE(child_->needs_push_properties()); | 3555 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3551 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3556 child_.get())); |
| 3552 | 3557 |
| 3553 grandchild2_->RemoveFromParent(); | 3558 grandchild2_->RemoveFromParent(); |
| 3554 | 3559 |
| 3555 EXPECT_FALSE(root_->needs_push_properties()); | 3560 EXPECT_FALSE( |
| 3556 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3561 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3557 EXPECT_TRUE(child_->needs_push_properties()); | 3562 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3558 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3563 child_.get())); |
| 3559 | 3564 |
| 3560 grandchild3_->RemoveFromParent(); | 3565 grandchild3_->RemoveFromParent(); |
| 3561 | 3566 |
| 3562 EXPECT_FALSE(root_->needs_push_properties()); | 3567 EXPECT_FALSE( |
| 3563 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3568 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3564 EXPECT_TRUE(child_->needs_push_properties()); | 3569 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3565 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3570 child_.get())); |
| 3566 | 3571 |
| 3567 EndTest(); | 3572 EndTest(); |
| 3568 break; | 3573 break; |
| 3569 } | 3574 } |
| 3570 } | 3575 } |
| 3571 }; | 3576 }; |
| 3572 | 3577 |
| 3573 MULTI_THREAD_TEST_F( | 3578 MULTI_THREAD_TEST_F( |
| 3574 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3579 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 3575 | 3580 |
| 3576 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3581 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 3577 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3582 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3578 protected: | 3583 protected: |
| 3579 void DidCommitAndDrawFrame() override { | 3584 void DidCommitAndDrawFrame() override { |
| 3580 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3585 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3581 switch (last_source_frame_number) { | 3586 switch (last_source_frame_number) { |
| 3582 case 0: | 3587 case 0: |
| 3583 layer_tree_host()->SetRootLayer(root_); | 3588 layer_tree_host()->SetRootLayer(root_); |
| 3584 break; | 3589 break; |
| 3585 case 1: | 3590 case 1: |
| 3586 EXPECT_FALSE(root_->needs_push_properties()); | 3591 EXPECT_FALSE( |
| 3587 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3592 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3588 EXPECT_FALSE(child_->needs_push_properties()); | 3593 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3589 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3594 child_.get())); |
| 3590 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3595 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3591 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3596 grandchild1_.get())); |
| 3592 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3597 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3593 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3598 grandchild2_.get())); |
| 3594 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3599 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3595 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3600 grandchild3_.get())); |
| 3596 | 3601 |
| 3597 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 3602 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3598 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3603 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3599 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3604 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3600 | 3605 |
| 3601 EXPECT_FALSE(root_->needs_push_properties()); | 3606 EXPECT_FALSE( |
| 3602 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3607 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3603 EXPECT_TRUE(child_->needs_push_properties()); | 3608 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3604 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3609 child_.get())); |
| 3605 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3610 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3606 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3611 grandchild1_.get())); |
| 3607 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3612 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3608 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3613 grandchild2_.get())); |
| 3609 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3614 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3610 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3615 grandchild3_.get())); |
| 3611 | 3616 |
| 3612 grandchild1_->RemoveFromParent(); | 3617 grandchild1_->RemoveFromParent(); |
| 3613 | 3618 |
| 3614 EXPECT_FALSE(root_->needs_push_properties()); | 3619 EXPECT_FALSE( |
| 3615 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3620 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3616 EXPECT_TRUE(child_->needs_push_properties()); | 3621 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3617 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3622 child_.get())); |
| 3618 | 3623 |
| 3619 grandchild2_->RemoveFromParent(); | 3624 grandchild2_->RemoveFromParent(); |
| 3620 | 3625 |
| 3621 EXPECT_FALSE(root_->needs_push_properties()); | 3626 EXPECT_FALSE( |
| 3622 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3627 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3623 EXPECT_TRUE(child_->needs_push_properties()); | 3628 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3624 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3629 child_.get())); |
| 3625 | 3630 |
| 3626 child_->RemoveFromParent(); | 3631 child_->RemoveFromParent(); |
| 3627 | 3632 |
| 3628 EXPECT_FALSE(root_->needs_push_properties()); | 3633 EXPECT_FALSE( |
| 3629 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3634 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3630 | 3635 |
| 3631 EndTest(); | 3636 EndTest(); |
| 3632 break; | 3637 break; |
| 3633 } | 3638 } |
| 3634 } | 3639 } |
| 3635 }; | 3640 }; |
| 3636 | 3641 |
| 3637 MULTI_THREAD_TEST_F( | 3642 MULTI_THREAD_TEST_F( |
| 3638 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3643 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 3639 | 3644 |
| 3640 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3645 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 3641 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3646 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3642 protected: | 3647 protected: |
| 3643 void DidCommitAndDrawFrame() override { | 3648 void DidCommitAndDrawFrame() override { |
| 3644 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3649 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3645 switch (last_source_frame_number) { | 3650 switch (last_source_frame_number) { |
| 3646 case 0: | 3651 case 0: |
| 3647 layer_tree_host()->SetRootLayer(root_); | 3652 layer_tree_host()->SetRootLayer(root_); |
| 3648 break; | 3653 break; |
| 3649 case 1: | 3654 case 1: |
| 3650 EXPECT_FALSE(root_->needs_push_properties()); | 3655 EXPECT_FALSE( |
| 3651 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3656 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3652 EXPECT_FALSE(child_->needs_push_properties()); | 3657 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3653 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3658 child_.get())); |
| 3654 EXPECT_FALSE(grandchild1_->needs_push_properties()); | 3659 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3655 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3660 grandchild1_.get())); |
| 3656 EXPECT_FALSE(grandchild2_->needs_push_properties()); | 3661 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3657 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3662 grandchild2_.get())); |
| 3658 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3663 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3659 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3664 grandchild3_.get())); |
| 3660 | 3665 |
| 3661 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3666 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3662 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3667 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3663 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 3668 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3664 | 3669 |
| 3665 EXPECT_FALSE(root_->needs_push_properties()); | 3670 EXPECT_FALSE( |
| 3666 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3671 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3667 EXPECT_TRUE(child_->needs_push_properties()); | 3672 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3668 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3673 child_.get())); |
| 3669 EXPECT_TRUE(grandchild1_->needs_push_properties()); | 3674 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3670 EXPECT_FALSE(grandchild1_->descendant_needs_push_properties()); | 3675 grandchild1_.get())); |
| 3671 EXPECT_TRUE(grandchild2_->needs_push_properties()); | 3676 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3672 EXPECT_FALSE(grandchild2_->descendant_needs_push_properties()); | 3677 grandchild2_.get())); |
| 3673 EXPECT_FALSE(grandchild3_->needs_push_properties()); | 3678 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3674 EXPECT_FALSE(grandchild3_->descendant_needs_push_properties()); | 3679 grandchild3_.get())); |
| 3675 | 3680 |
| 3676 grandchild1_->RemoveFromParent(); | 3681 grandchild1_->RemoveFromParent(); |
| 3677 | 3682 |
| 3678 EXPECT_FALSE(root_->needs_push_properties()); | 3683 EXPECT_FALSE( |
| 3679 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3684 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3680 EXPECT_TRUE(child_->needs_push_properties()); | 3685 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3681 EXPECT_TRUE(child_->descendant_needs_push_properties()); | 3686 child_.get())); |
| 3682 | 3687 |
| 3683 grandchild2_->RemoveFromParent(); | 3688 grandchild2_->RemoveFromParent(); |
| 3684 | 3689 |
| 3685 EXPECT_FALSE(root_->needs_push_properties()); | 3690 EXPECT_FALSE( |
| 3686 EXPECT_TRUE(root_->descendant_needs_push_properties()); | 3691 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3687 EXPECT_TRUE(child_->needs_push_properties()); | 3692 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3688 EXPECT_FALSE(child_->descendant_needs_push_properties()); | 3693 child_.get())); |
| 3689 | 3694 |
| 3690 child_->RemoveFromParent(); | 3695 child_->RemoveFromParent(); |
| 3691 | 3696 |
| 3692 EXPECT_FALSE(root_->needs_push_properties()); | 3697 EXPECT_FALSE( |
| 3693 EXPECT_FALSE(root_->descendant_needs_push_properties()); | 3698 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3694 | 3699 |
| 3695 EndTest(); | 3700 EndTest(); |
| 3696 break; | 3701 break; |
| 3697 } | 3702 } |
| 3698 } | 3703 } |
| 3699 }; | 3704 }; |
| 3700 | 3705 |
| 3701 MULTI_THREAD_TEST_F( | 3706 MULTI_THREAD_TEST_F( |
| 3702 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 3707 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
| 3703 | 3708 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3868 layer_tree_host()->SetRootLayer(root_layer_); | 3873 layer_tree_host()->SetRootLayer(root_layer_); |
| 3869 LayerTreeHostTest::SetupTree(); | 3874 LayerTreeHostTest::SetupTree(); |
| 3870 } | 3875 } |
| 3871 | 3876 |
| 3872 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 3877 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 3873 | 3878 |
| 3874 void DidCommitAndDrawFrame() override { | 3879 void DidCommitAndDrawFrame() override { |
| 3875 switch (layer_tree_host()->source_frame_number()) { | 3880 switch (layer_tree_host()->source_frame_number()) { |
| 3876 case 1: | 3881 case 1: |
| 3877 // The layer type used does not need to push properties every frame. | 3882 // The layer type used does not need to push properties every frame. |
| 3878 EXPECT_FALSE(child_layer_->needs_push_properties()); | 3883 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3884 child_layer_.get())); |
| 3879 | 3885 |
| 3880 // Change the bounds of the child layer, but make it skipped | 3886 // Change the bounds of the child layer, but make it skipped |
| 3881 // by CalculateDrawProperties. | 3887 // by CalculateDrawProperties. |
| 3882 parent_layer_->SetOpacity(0.f); | 3888 parent_layer_->SetOpacity(0.f); |
| 3883 child_layer_->SetBounds(gfx::Size(5, 5)); | 3889 child_layer_->SetBounds(gfx::Size(5, 5)); |
| 3884 break; | 3890 break; |
| 3885 case 2: | 3891 case 2: |
| 3886 // The bounds of the child layer were pushed to the impl side. | 3892 // The bounds of the child layer were pushed to the impl side. |
| 3887 EXPECT_FALSE(child_layer_->needs_push_properties()); | 3893 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( |
| 3894 child_layer_.get())); |
| 3888 | 3895 |
| 3889 EndTest(); | 3896 EndTest(); |
| 3890 break; | 3897 break; |
| 3891 } | 3898 } |
| 3892 } | 3899 } |
| 3893 | 3900 |
| 3894 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 3901 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 3895 LayerImpl* root = impl->active_tree()->root_layer(); | 3902 LayerImpl* root = impl->active_tree()->root_layer(); |
| 3896 LayerImpl* parent = root->children()[0].get(); | 3903 LayerImpl* parent = root->children()[0].get(); |
| 3897 LayerImpl* child = parent->children()[0].get(); | 3904 LayerImpl* child = parent->children()[0].get(); |
| (...skipping 2772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6670 EndTest(); | 6677 EndTest(); |
| 6671 } | 6678 } |
| 6672 | 6679 |
| 6673 void AfterTest() override {} | 6680 void AfterTest() override {} |
| 6674 }; | 6681 }; |
| 6675 | 6682 |
| 6676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6683 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6677 | 6684 |
| 6678 } // namespace | 6685 } // namespace |
| 6679 } // namespace cc | 6686 } // namespace cc |
| OLD | NEW |