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 3014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 class PushPropertiesCountingLayer : public Layer { | 3025 class PushPropertiesCountingLayer : public Layer { |
3026 public: | 3026 public: |
3027 static scoped_refptr<PushPropertiesCountingLayer> Create() { | 3027 static scoped_refptr<PushPropertiesCountingLayer> Create() { |
3028 return new PushPropertiesCountingLayer(); | 3028 return new PushPropertiesCountingLayer(); |
3029 } | 3029 } |
3030 | 3030 |
3031 void PushPropertiesTo(LayerImpl* layer) override { | 3031 void PushPropertiesTo(LayerImpl* layer) override { |
3032 Layer::PushPropertiesTo(layer); | 3032 Layer::PushPropertiesTo(layer); |
3033 push_properties_count_++; | 3033 push_properties_count_++; |
3034 if (persist_needs_push_properties_) { | 3034 if (persist_needs_push_properties_) { |
3035 layer_tree_host()->AddLayerShouldPushProperties(this); | 3035 layer_tree_host()->GetLayerTree()->AddLayerShouldPushProperties(this); |
3036 } | 3036 } |
3037 } | 3037 } |
3038 | 3038 |
3039 // Something to make this layer push properties, but no other layer. | 3039 // Something to make this layer push properties, but no other layer. |
3040 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } | 3040 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } |
3041 | 3041 |
3042 std::unique_ptr<LayerImpl> CreateLayerImpl( | 3042 std::unique_ptr<LayerImpl> CreateLayerImpl( |
3043 LayerTreeImpl* tree_impl) override { | 3043 LayerTreeImpl* tree_impl) override { |
3044 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); | 3044 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); |
3045 } | 3045 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3112 other_root_->push_properties_count()) | 3112 other_root_->push_properties_count()) |
3113 << "num_commits: " << num_commits_; | 3113 << "num_commits: " << num_commits_; |
3114 EXPECT_EQ(expected_push_properties_leaf_layer_, | 3114 EXPECT_EQ(expected_push_properties_leaf_layer_, |
3115 leaf_always_pushing_layer_->push_properties_count()) | 3115 leaf_always_pushing_layer_->push_properties_count()) |
3116 << "num_commits: " << num_commits_; | 3116 << "num_commits: " << num_commits_; |
3117 | 3117 |
3118 ++num_commits_; | 3118 ++num_commits_; |
3119 | 3119 |
3120 // The scrollbar layer always needs to be pushed. | 3120 // The scrollbar layer always needs to be pushed. |
3121 if (root_->layer_tree_host()) { | 3121 if (root_->layer_tree_host()) { |
3122 EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3122 EXPECT_FALSE(root_->layer_tree_host() |
3123 root_.get())); | 3123 ->GetLayerTree() |
| 3124 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
3124 } | 3125 } |
3125 if (child2_->layer_tree_host()) { | 3126 if (child2_->layer_tree_host()) { |
3126 EXPECT_FALSE( | 3127 EXPECT_FALSE(child2_->layer_tree_host() |
3127 child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3128 ->GetLayerTree() |
3128 child2_.get())); | 3129 ->LayerNeedsPushPropertiesForTesting(child2_.get())); |
3129 } | 3130 } |
3130 if (leaf_always_pushing_layer_->layer_tree_host()) { | 3131 if (leaf_always_pushing_layer_->layer_tree_host()) { |
3131 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() | 3132 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() |
| 3133 ->GetLayerTree() |
3132 ->LayerNeedsPushPropertiesForTesting( | 3134 ->LayerNeedsPushPropertiesForTesting( |
3133 leaf_always_pushing_layer_.get())); | 3135 leaf_always_pushing_layer_.get())); |
3134 } | 3136 } |
3135 | 3137 |
3136 // child_ and grandchild_ don't persist their need to push properties. | 3138 // child_ and grandchild_ don't persist their need to push properties. |
3137 if (child_->layer_tree_host()) { | 3139 if (child_->layer_tree_host()) { |
3138 EXPECT_FALSE( | 3140 EXPECT_FALSE(child_->layer_tree_host() |
3139 child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3141 ->GetLayerTree() |
3140 child_.get())); | 3142 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3141 } | 3143 } |
3142 if (grandchild_->layer_tree_host()) { | 3144 if (grandchild_->layer_tree_host()) { |
3143 EXPECT_FALSE( | 3145 EXPECT_FALSE(grandchild_->layer_tree_host() |
3144 grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3146 ->GetLayerTree() |
3145 grandchild_.get())); | 3147 ->LayerNeedsPushPropertiesForTesting(grandchild_.get())); |
3146 } | 3148 } |
3147 | 3149 |
3148 if (other_root_->layer_tree_host()) { | 3150 if (other_root_->layer_tree_host()) { |
3149 EXPECT_FALSE( | 3151 EXPECT_FALSE(other_root_->layer_tree_host() |
3150 other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3152 ->GetLayerTree() |
3151 other_root_.get())); | 3153 ->LayerNeedsPushPropertiesForTesting(other_root_.get())); |
3152 } | 3154 } |
3153 | 3155 |
3154 switch (num_commits_) { | 3156 switch (num_commits_) { |
3155 case 1: | 3157 case 1: |
3156 layer_tree_host()->SetRootLayer(root_); | 3158 layer_tree_host()->SetRootLayer(root_); |
3157 // Layers added to the tree get committed. | 3159 // Layers added to the tree get committed. |
3158 ++expected_push_properties_root_; | 3160 ++expected_push_properties_root_; |
3159 ++expected_push_properties_child_; | 3161 ++expected_push_properties_child_; |
3160 ++expected_push_properties_grandchild_; | 3162 ++expected_push_properties_grandchild_; |
3161 ++expected_push_properties_child2_; | 3163 ++expected_push_properties_child2_; |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3492 case 1: { | 3494 case 1: { |
3493 // During update, the ignore_set_needs_commit_ bit is set to true to | 3495 // During update, the ignore_set_needs_commit_ bit is set to true to |
3494 // avoid causing a second commit to be scheduled. If a property change | 3496 // avoid causing a second commit to be scheduled. If a property change |
3495 // is made during this, however, it needs to be pushed in the upcoming | 3497 // is made during this, however, it needs to be pushed in the upcoming |
3496 // commit. | 3498 // commit. |
3497 std::unique_ptr<base::AutoReset<bool>> ignore = | 3499 std::unique_ptr<base::AutoReset<bool>> ignore = |
3498 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3500 scrollbar_layer_->IgnoreSetNeedsCommit(); |
3499 | 3501 |
3500 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3502 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
3501 | 3503 |
3502 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3504 EXPECT_TRUE( |
3503 scrollbar_layer_.get())); | 3505 layer_tree_host() |
| 3506 ->GetLayerTree() |
| 3507 ->LayerNeedsPushPropertiesForTesting(scrollbar_layer_.get())); |
3504 layer_tree_host()->SetNeedsCommit(); | 3508 layer_tree_host()->SetNeedsCommit(); |
3505 | 3509 |
3506 scrollbar_layer_->reset_push_properties_count(); | 3510 scrollbar_layer_->reset_push_properties_count(); |
3507 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3511 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
3508 break; | 3512 break; |
3509 } | 3513 } |
3510 case 2: | 3514 case 2: |
3511 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3515 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
3512 EndTest(); | 3516 EndTest(); |
3513 break; | 3517 break; |
(...skipping 15 matching lines...) Expand all Loading... |
3529 void SetupTree() override { | 3533 void SetupTree() override { |
3530 root_ = PushPropertiesCountingLayer::Create(); | 3534 root_ = PushPropertiesCountingLayer::Create(); |
3531 child_ = PushPropertiesCountingLayer::Create(); | 3535 child_ = PushPropertiesCountingLayer::Create(); |
3532 root_->AddChild(child_); | 3536 root_->AddChild(child_); |
3533 | 3537 |
3534 layer_tree_host()->SetRootLayer(root_); | 3538 layer_tree_host()->SetRootLayer(root_); |
3535 LayerTreeHostTest::SetupTree(); | 3539 LayerTreeHostTest::SetupTree(); |
3536 } | 3540 } |
3537 | 3541 |
3538 void DidCommitAndDrawFrame() override { | 3542 void DidCommitAndDrawFrame() override { |
| 3543 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3539 switch (layer_tree_host()->source_frame_number()) { | 3544 switch (layer_tree_host()->source_frame_number()) { |
3540 case 0: | 3545 case 0: |
3541 break; | 3546 break; |
3542 case 1: { | 3547 case 1: { |
3543 // During update, the ignore_set_needs_commit_ bit is set to true to | 3548 // During update, the ignore_set_needs_commit_ bit is set to true to |
3544 // avoid causing a second commit to be scheduled. If a property change | 3549 // avoid causing a second commit to be scheduled. If a property change |
3545 // is made during this, however, it needs to be pushed in the upcoming | 3550 // is made during this, however, it needs to be pushed in the upcoming |
3546 // commit. | 3551 // commit. |
3547 EXPECT_FALSE( | 3552 EXPECT_FALSE( |
3548 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3553 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3549 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3554 EXPECT_FALSE( |
3550 child_.get())); | 3555 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3551 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3556 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
3552 root_->reset_push_properties_count(); | 3557 root_->reset_push_properties_count(); |
3553 child_->reset_push_properties_count(); | 3558 child_->reset_push_properties_count(); |
3554 child_->SetDrawsContent(true); | 3559 child_->SetDrawsContent(true); |
3555 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3560 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
3556 EXPECT_EQ(0u, root_->push_properties_count()); | 3561 EXPECT_EQ(0u, root_->push_properties_count()); |
3557 EXPECT_EQ(0u, child_->push_properties_count()); | 3562 EXPECT_EQ(0u, child_->push_properties_count()); |
3558 EXPECT_TRUE( | 3563 EXPECT_TRUE( |
3559 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3564 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3560 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3565 EXPECT_TRUE( |
3561 child_.get())); | 3566 |
| 3567 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3562 break; | 3568 break; |
3563 } | 3569 } |
3564 case 2: | 3570 case 2: |
3565 EXPECT_EQ(1u, root_->push_properties_count()); | 3571 EXPECT_EQ(1u, root_->push_properties_count()); |
3566 EXPECT_EQ(1u, child_->push_properties_count()); | 3572 EXPECT_EQ(1u, child_->push_properties_count()); |
3567 EXPECT_FALSE( | 3573 EXPECT_FALSE( |
3568 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3574 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3569 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3575 EXPECT_FALSE( |
3570 child_.get())); | 3576 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3571 EndTest(); | 3577 EndTest(); |
3572 break; | 3578 break; |
3573 } | 3579 } |
3574 } | 3580 } |
3575 | 3581 |
3576 void AfterTest() override {} | 3582 void AfterTest() override {} |
3577 | 3583 |
3578 scoped_refptr<PushPropertiesCountingLayer> root_; | 3584 scoped_refptr<PushPropertiesCountingLayer> root_; |
3579 scoped_refptr<PushPropertiesCountingLayer> child_; | 3585 scoped_refptr<PushPropertiesCountingLayer> child_; |
3580 }; | 3586 }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3627 | 3633 |
3628 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3634 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
3629 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3635 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3630 protected: | 3636 protected: |
3631 void DidCommitAndDrawFrame() override { | 3637 void DidCommitAndDrawFrame() override { |
3632 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3638 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3633 switch (last_source_frame_number) { | 3639 switch (last_source_frame_number) { |
3634 case 0: | 3640 case 0: |
3635 // All layers will need push properties as we set their layer tree host | 3641 // All layers will need push properties as we set their layer tree host |
3636 layer_tree_host()->SetRootLayer(root_); | 3642 layer_tree_host()->SetRootLayer(root_); |
| 3643 EXPECT_TRUE(layer_tree_host() |
| 3644 ->GetLayerTree() |
| 3645 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3646 EXPECT_TRUE(layer_tree_host() |
| 3647 ->GetLayerTree() |
| 3648 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3637 EXPECT_TRUE( | 3649 EXPECT_TRUE( |
3638 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3650 layer_tree_host() |
3639 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3651 ->GetLayerTree() |
3640 child_.get())); | 3652 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3641 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3653 EXPECT_TRUE( |
3642 grandchild1_.get())); | 3654 layer_tree_host() |
3643 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3655 ->GetLayerTree() |
3644 grandchild2_.get())); | 3656 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3645 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3657 EXPECT_TRUE( |
3646 grandchild3_.get())); | 3658 layer_tree_host() |
| 3659 ->GetLayerTree() |
| 3660 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3647 break; | 3661 break; |
3648 case 1: | 3662 case 1: |
3649 EndTest(); | 3663 EndTest(); |
3650 break; | 3664 break; |
3651 } | 3665 } |
3652 } | 3666 } |
3653 }; | 3667 }; |
3654 | 3668 |
3655 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3669 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
3656 | 3670 |
3657 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3671 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
3658 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3672 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3659 protected: | 3673 protected: |
3660 void DidCommitAndDrawFrame() override { | 3674 void DidCommitAndDrawFrame() override { |
3661 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3675 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3662 switch (last_source_frame_number) { | 3676 switch (last_source_frame_number) { |
3663 case 0: | 3677 case 0: |
3664 layer_tree_host()->SetRootLayer(root_); | 3678 layer_tree_host()->SetRootLayer(root_); |
3665 break; | 3679 break; |
3666 case 1: | 3680 case 1: |
| 3681 EXPECT_FALSE(layer_tree_host() |
| 3682 ->GetLayerTree() |
| 3683 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3684 EXPECT_FALSE(layer_tree_host() |
| 3685 ->GetLayerTree() |
| 3686 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3667 EXPECT_FALSE( | 3687 EXPECT_FALSE( |
3668 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3688 layer_tree_host() |
3669 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3689 ->GetLayerTree() |
3670 child_.get())); | 3690 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3671 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3691 EXPECT_FALSE( |
3672 grandchild1_.get())); | 3692 layer_tree_host() |
3673 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3693 ->GetLayerTree() |
3674 grandchild2_.get())); | 3694 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3675 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3695 EXPECT_FALSE( |
3676 grandchild3_.get())); | 3696 layer_tree_host() |
| 3697 ->GetLayerTree() |
| 3698 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3677 | 3699 |
3678 grandchild1_->RemoveFromParent(); | 3700 grandchild1_->RemoveFromParent(); |
3679 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3701 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
3680 | 3702 |
| 3703 EXPECT_FALSE(layer_tree_host() |
| 3704 ->GetLayerTree() |
| 3705 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3706 EXPECT_FALSE(layer_tree_host() |
| 3707 ->GetLayerTree() |
| 3708 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3681 EXPECT_FALSE( | 3709 EXPECT_FALSE( |
3682 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3710 layer_tree_host() |
3683 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3711 ->GetLayerTree() |
3684 child_.get())); | 3712 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3685 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3713 EXPECT_FALSE( |
3686 grandchild2_.get())); | 3714 layer_tree_host() |
3687 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3715 ->GetLayerTree() |
3688 grandchild3_.get())); | 3716 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3689 | 3717 |
3690 child_->AddChild(grandchild1_); | 3718 child_->AddChild(grandchild1_); |
3691 | 3719 |
| 3720 EXPECT_FALSE(layer_tree_host() |
| 3721 ->GetLayerTree() |
| 3722 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3723 EXPECT_FALSE(layer_tree_host() |
| 3724 ->GetLayerTree() |
| 3725 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3726 EXPECT_TRUE( |
| 3727 layer_tree_host() |
| 3728 ->GetLayerTree() |
| 3729 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3692 EXPECT_FALSE( | 3730 EXPECT_FALSE( |
3693 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3731 layer_tree_host() |
3694 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3732 ->GetLayerTree() |
3695 child_.get())); | 3733 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3696 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3734 EXPECT_FALSE( |
3697 grandchild1_.get())); | 3735 layer_tree_host() |
3698 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3736 ->GetLayerTree() |
3699 grandchild2_.get())); | 3737 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3700 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
3701 grandchild3_.get())); | |
3702 | 3738 |
3703 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3739 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
3704 | 3740 |
| 3741 EXPECT_FALSE(layer_tree_host() |
| 3742 ->GetLayerTree() |
| 3743 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3744 EXPECT_FALSE(layer_tree_host() |
| 3745 ->GetLayerTree() |
| 3746 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3747 EXPECT_TRUE( |
| 3748 layer_tree_host() |
| 3749 ->GetLayerTree() |
| 3750 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3751 EXPECT_TRUE( |
| 3752 layer_tree_host() |
| 3753 ->GetLayerTree() |
| 3754 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3705 EXPECT_FALSE( | 3755 EXPECT_FALSE( |
3706 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3756 layer_tree_host() |
3707 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3757 ->GetLayerTree() |
3708 child_.get())); | 3758 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3709 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
3710 grandchild1_.get())); | |
3711 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
3712 grandchild2_.get())); | |
3713 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
3714 grandchild3_.get())); | |
3715 | 3759 |
3716 // grandchild2_ will still need a push properties. | 3760 // grandchild2_ will still need a push properties. |
3717 grandchild1_->RemoveFromParent(); | 3761 grandchild1_->RemoveFromParent(); |
3718 | 3762 |
3719 EXPECT_FALSE( | 3763 EXPECT_FALSE(layer_tree_host() |
3720 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3764 ->GetLayerTree() |
3721 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3765 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
3722 child_.get())); | 3766 EXPECT_FALSE(layer_tree_host() |
| 3767 ->GetLayerTree() |
| 3768 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3723 | 3769 |
3724 // grandchild3_ does not need a push properties, so recursing should | 3770 // grandchild3_ does not need a push properties, so recursing should |
3725 // no longer be needed. | 3771 // no longer be needed. |
3726 grandchild2_->RemoveFromParent(); | 3772 grandchild2_->RemoveFromParent(); |
3727 | 3773 |
3728 EXPECT_FALSE( | 3774 EXPECT_FALSE(layer_tree_host() |
3729 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3775 ->GetLayerTree() |
3730 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3776 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
3731 child_.get())); | 3777 EXPECT_FALSE(layer_tree_host() |
| 3778 ->GetLayerTree() |
| 3779 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
3732 EndTest(); | 3780 EndTest(); |
3733 break; | 3781 break; |
3734 } | 3782 } |
3735 } | 3783 } |
3736 }; | 3784 }; |
3737 | 3785 |
3738 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3786 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
3739 | 3787 |
3740 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3788 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
3741 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3789 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3742 protected: | 3790 protected: |
3743 void DidCommitAndDrawFrame() override { | 3791 void DidCommitAndDrawFrame() override { |
| 3792 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3744 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3793 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3745 switch (last_source_frame_number) { | 3794 switch (last_source_frame_number) { |
3746 case 0: | 3795 case 0: |
3747 layer_tree_host()->SetRootLayer(root_); | 3796 layer_tree_host()->SetRootLayer(root_); |
3748 grandchild1_->set_persist_needs_push_properties(true); | 3797 grandchild1_->set_persist_needs_push_properties(true); |
3749 grandchild2_->set_persist_needs_push_properties(true); | 3798 grandchild2_->set_persist_needs_push_properties(true); |
3750 break; | 3799 break; |
3751 case 1: | 3800 case 1: |
3752 EXPECT_FALSE( | 3801 EXPECT_FALSE( |
3753 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3802 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3754 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3803 EXPECT_FALSE( |
3755 child_.get())); | 3804 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3756 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3805 EXPECT_TRUE( |
3757 grandchild1_.get())); | 3806 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3758 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3807 EXPECT_TRUE( |
3759 grandchild2_.get())); | 3808 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3760 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3809 EXPECT_FALSE( |
3761 grandchild3_.get())); | 3810 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3762 | 3811 |
3763 // grandchild2_ will still need a push properties. | 3812 // grandchild2_ will still need a push properties. |
3764 grandchild1_->RemoveFromParent(); | 3813 grandchild1_->RemoveFromParent(); |
3765 | 3814 |
3766 EXPECT_FALSE( | 3815 EXPECT_FALSE( |
3767 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3816 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3768 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3817 EXPECT_FALSE( |
3769 child_.get())); | 3818 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3770 | 3819 |
3771 // grandchild3_ does not need a push properties, so recursing should | 3820 // grandchild3_ does not need a push properties, so recursing should |
3772 // no longer be needed. | 3821 // no longer be needed. |
3773 grandchild2_->RemoveFromParent(); | 3822 grandchild2_->RemoveFromParent(); |
3774 | 3823 |
3775 EXPECT_FALSE( | 3824 EXPECT_FALSE( |
3776 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3825 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3777 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3826 EXPECT_FALSE( |
3778 child_.get())); | 3827 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3779 EndTest(); | 3828 EndTest(); |
3780 break; | 3829 break; |
3781 } | 3830 } |
3782 } | 3831 } |
3783 }; | 3832 }; |
3784 | 3833 |
3785 MULTI_THREAD_TEST_F( | 3834 MULTI_THREAD_TEST_F( |
3786 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3835 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
3787 | 3836 |
3788 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3837 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
3789 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3838 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3790 protected: | 3839 protected: |
3791 void DidCommitAndDrawFrame() override { | 3840 void DidCommitAndDrawFrame() override { |
| 3841 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3792 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3842 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3793 switch (last_source_frame_number) { | 3843 switch (last_source_frame_number) { |
3794 case 0: | 3844 case 0: |
3795 layer_tree_host()->SetRootLayer(root_); | 3845 layer_tree_host()->SetRootLayer(root_); |
3796 break; | 3846 break; |
3797 case 1: | 3847 case 1: |
3798 EXPECT_FALSE( | 3848 EXPECT_FALSE( |
3799 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3849 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3800 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3850 EXPECT_FALSE( |
3801 child_.get())); | 3851 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3802 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3852 EXPECT_FALSE( |
3803 grandchild1_.get())); | 3853 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3804 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3854 EXPECT_FALSE( |
3805 grandchild2_.get())); | 3855 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3806 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3856 EXPECT_FALSE( |
3807 grandchild3_.get())); | 3857 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3808 | 3858 |
3809 // Change grandchildren while their parent is not in the tree. | 3859 // Change grandchildren while their parent is not in the tree. |
3810 child_->RemoveFromParent(); | 3860 child_->RemoveFromParent(); |
3811 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3861 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
3812 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3862 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
3813 root_->AddChild(child_); | 3863 root_->AddChild(child_); |
3814 | 3864 |
3815 EXPECT_FALSE( | 3865 EXPECT_FALSE( |
3816 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3866 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3817 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3867 EXPECT_TRUE( |
3818 child_.get())); | 3868 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3819 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3869 EXPECT_TRUE( |
3820 grandchild1_.get())); | 3870 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3821 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3871 EXPECT_TRUE( |
3822 grandchild2_.get())); | 3872 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3823 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3873 EXPECT_TRUE( |
3824 grandchild3_.get())); | 3874 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3825 | 3875 |
3826 grandchild1_->RemoveFromParent(); | 3876 grandchild1_->RemoveFromParent(); |
3827 | 3877 |
3828 EXPECT_FALSE( | 3878 EXPECT_FALSE( |
3829 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3879 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3830 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3880 EXPECT_TRUE( |
3831 child_.get())); | 3881 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3832 | 3882 |
3833 grandchild2_->RemoveFromParent(); | 3883 grandchild2_->RemoveFromParent(); |
3834 | 3884 |
3835 EXPECT_FALSE( | 3885 EXPECT_FALSE( |
3836 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3886 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3837 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3887 EXPECT_TRUE( |
3838 child_.get())); | 3888 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3839 | 3889 |
3840 grandchild3_->RemoveFromParent(); | 3890 grandchild3_->RemoveFromParent(); |
3841 | 3891 |
3842 EXPECT_FALSE( | 3892 EXPECT_FALSE( |
3843 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3893 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3844 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3894 EXPECT_TRUE( |
3845 child_.get())); | 3895 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3846 | 3896 |
3847 EndTest(); | 3897 EndTest(); |
3848 break; | 3898 break; |
3849 } | 3899 } |
3850 } | 3900 } |
3851 }; | 3901 }; |
3852 | 3902 |
3853 MULTI_THREAD_TEST_F( | 3903 MULTI_THREAD_TEST_F( |
3854 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3904 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
3855 | 3905 |
3856 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3906 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
3857 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3907 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3858 protected: | 3908 protected: |
3859 void DidCommitAndDrawFrame() override { | 3909 void DidCommitAndDrawFrame() override { |
| 3910 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3860 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3911 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3861 switch (last_source_frame_number) { | 3912 switch (last_source_frame_number) { |
3862 case 0: | 3913 case 0: |
3863 layer_tree_host()->SetRootLayer(root_); | 3914 layer_tree_host()->SetRootLayer(root_); |
3864 break; | 3915 break; |
3865 case 1: | 3916 case 1: |
3866 EXPECT_FALSE( | 3917 EXPECT_FALSE( |
3867 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3918 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3868 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3919 EXPECT_FALSE( |
3869 child_.get())); | 3920 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3870 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3921 EXPECT_FALSE( |
3871 grandchild1_.get())); | 3922 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3872 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3923 EXPECT_FALSE( |
3873 grandchild2_.get())); | 3924 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3874 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3925 EXPECT_FALSE( |
3875 grandchild3_.get())); | 3926 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3876 | 3927 |
3877 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 3928 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
3878 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3929 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
3879 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3930 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
3880 | 3931 |
3881 EXPECT_FALSE( | 3932 EXPECT_FALSE( |
3882 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3933 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3883 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3934 EXPECT_TRUE( |
3884 child_.get())); | 3935 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3885 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3936 EXPECT_TRUE( |
3886 grandchild1_.get())); | 3937 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3887 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3938 EXPECT_TRUE( |
3888 grandchild2_.get())); | 3939 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3889 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3940 EXPECT_FALSE( |
3890 grandchild3_.get())); | 3941 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3891 | 3942 |
3892 grandchild1_->RemoveFromParent(); | 3943 grandchild1_->RemoveFromParent(); |
3893 | 3944 |
3894 EXPECT_FALSE( | 3945 EXPECT_FALSE( |
3895 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3946 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3896 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3947 EXPECT_TRUE( |
3897 child_.get())); | 3948 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3898 | 3949 |
3899 grandchild2_->RemoveFromParent(); | 3950 grandchild2_->RemoveFromParent(); |
3900 | 3951 |
3901 EXPECT_FALSE( | 3952 EXPECT_FALSE( |
3902 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3953 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3903 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3954 EXPECT_TRUE( |
3904 child_.get())); | 3955 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3905 | 3956 |
3906 child_->RemoveFromParent(); | 3957 child_->RemoveFromParent(); |
3907 | 3958 |
3908 EXPECT_FALSE( | 3959 EXPECT_FALSE( |
3909 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3960 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3910 | 3961 |
3911 EndTest(); | 3962 EndTest(); |
3912 break; | 3963 break; |
3913 } | 3964 } |
3914 } | 3965 } |
3915 }; | 3966 }; |
3916 | 3967 |
3917 MULTI_THREAD_TEST_F( | 3968 MULTI_THREAD_TEST_F( |
3918 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3969 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
3919 | 3970 |
3920 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3971 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
3921 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3972 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
3922 protected: | 3973 protected: |
3923 void DidCommitAndDrawFrame() override { | 3974 void DidCommitAndDrawFrame() override { |
| 3975 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
3924 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3976 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
3925 switch (last_source_frame_number) { | 3977 switch (last_source_frame_number) { |
3926 case 0: | 3978 case 0: |
3927 layer_tree_host()->SetRootLayer(root_); | 3979 layer_tree_host()->SetRootLayer(root_); |
3928 break; | 3980 break; |
3929 case 1: | 3981 case 1: |
3930 EXPECT_FALSE( | 3982 EXPECT_FALSE( |
3931 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3983 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3932 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3984 EXPECT_FALSE( |
3933 child_.get())); | 3985 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3934 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3986 EXPECT_FALSE( |
3935 grandchild1_.get())); | 3987 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3936 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3988 EXPECT_FALSE( |
3937 grandchild2_.get())); | 3989 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3938 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3990 EXPECT_FALSE( |
3939 grandchild3_.get())); | 3991 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3940 | 3992 |
3941 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3993 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
3942 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3994 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
3943 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 3995 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
3944 | 3996 |
3945 EXPECT_FALSE( | 3997 EXPECT_FALSE( |
3946 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3998 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3947 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3999 EXPECT_TRUE( |
3948 child_.get())); | 4000 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3949 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4001 EXPECT_TRUE( |
3950 grandchild1_.get())); | 4002 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
3951 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4003 EXPECT_TRUE( |
3952 grandchild2_.get())); | 4004 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
3953 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4005 EXPECT_FALSE( |
3954 grandchild3_.get())); | 4006 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
3955 | 4007 |
3956 grandchild1_->RemoveFromParent(); | 4008 grandchild1_->RemoveFromParent(); |
3957 | 4009 |
3958 EXPECT_FALSE( | 4010 EXPECT_FALSE( |
3959 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4011 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3960 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4012 EXPECT_TRUE( |
3961 child_.get())); | 4013 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3962 | 4014 |
3963 grandchild2_->RemoveFromParent(); | 4015 grandchild2_->RemoveFromParent(); |
3964 | 4016 |
3965 EXPECT_FALSE( | 4017 EXPECT_FALSE( |
3966 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4018 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3967 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4019 EXPECT_TRUE( |
3968 child_.get())); | 4020 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
3969 | 4021 |
3970 child_->RemoveFromParent(); | 4022 child_->RemoveFromParent(); |
3971 | 4023 |
3972 EXPECT_FALSE( | 4024 EXPECT_FALSE( |
3973 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4025 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
3974 | 4026 |
3975 EndTest(); | 4027 EndTest(); |
3976 break; | 4028 break; |
3977 } | 4029 } |
3978 } | 4030 } |
3979 }; | 4031 }; |
3980 | 4032 |
3981 MULTI_THREAD_TEST_F( | 4033 MULTI_THREAD_TEST_F( |
3982 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 4034 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
3983 | 4035 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4123 child_layer_->SetIsDrawable(true); | 4175 child_layer_->SetIsDrawable(true); |
4124 parent_layer_->AddChild(child_layer_); | 4176 parent_layer_->AddChild(child_layer_); |
4125 | 4177 |
4126 layer_tree_host()->SetRootLayer(root_layer_); | 4178 layer_tree_host()->SetRootLayer(root_layer_); |
4127 LayerTreeHostTest::SetupTree(); | 4179 LayerTreeHostTest::SetupTree(); |
4128 } | 4180 } |
4129 | 4181 |
4130 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4182 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
4131 | 4183 |
4132 void DidCommitAndDrawFrame() override { | 4184 void DidCommitAndDrawFrame() override { |
| 4185 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
4133 switch (layer_tree_host()->source_frame_number()) { | 4186 switch (layer_tree_host()->source_frame_number()) { |
4134 case 1: | 4187 case 1: |
4135 // The layer type used does not need to push properties every frame. | 4188 // The layer type used does not need to push properties every frame. |
4136 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4189 EXPECT_FALSE( |
4137 child_layer_.get())); | 4190 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); |
4138 | 4191 |
4139 // Change the bounds of the child layer, but make it skipped | 4192 // Change the bounds of the child layer, but make it skipped |
4140 // by CalculateDrawProperties. | 4193 // by CalculateDrawProperties. |
4141 parent_layer_->SetOpacity(0.f); | 4194 parent_layer_->SetOpacity(0.f); |
4142 child_layer_->SetBounds(gfx::Size(5, 5)); | 4195 child_layer_->SetBounds(gfx::Size(5, 5)); |
4143 break; | 4196 break; |
4144 case 2: | 4197 case 2: |
4145 // The bounds of the child layer were pushed to the impl side. | 4198 // The bounds of the child layer were pushed to the impl side. |
4146 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4199 EXPECT_FALSE( |
4147 child_layer_.get())); | 4200 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); |
4148 | 4201 |
4149 EndTest(); | 4202 EndTest(); |
4150 break; | 4203 break; |
4151 } | 4204 } |
4152 } | 4205 } |
4153 | 4206 |
4154 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 4207 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
4155 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); | 4208 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); |
4156 | 4209 |
4157 switch (impl->active_tree()->source_frame_number()) { | 4210 switch (impl->active_tree()->source_frame_number()) { |
(...skipping 2701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6859 private: | 6912 private: |
6860 FakeContentLayerClient client_; | 6913 FakeContentLayerClient client_; |
6861 const gfx::Size viewport_size_; | 6914 const gfx::Size viewport_size_; |
6862 const gfx::Size large_image_size_; | 6915 const gfx::Size large_image_size_; |
6863 }; | 6916 }; |
6864 | 6917 |
6865 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 6918 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
6866 | 6919 |
6867 } // namespace | 6920 } // namespace |
6868 } // namespace cc | 6921 } // namespace cc |
OLD | NEW |