| 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 3037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3048 class PushPropertiesCountingLayer : public Layer { | 3048 class PushPropertiesCountingLayer : public Layer { |
| 3049 public: | 3049 public: |
| 3050 static scoped_refptr<PushPropertiesCountingLayer> Create() { | 3050 static scoped_refptr<PushPropertiesCountingLayer> Create() { |
| 3051 return new PushPropertiesCountingLayer(); | 3051 return new PushPropertiesCountingLayer(); |
| 3052 } | 3052 } |
| 3053 | 3053 |
| 3054 void PushPropertiesTo(LayerImpl* layer) override { | 3054 void PushPropertiesTo(LayerImpl* layer) override { |
| 3055 Layer::PushPropertiesTo(layer); | 3055 Layer::PushPropertiesTo(layer); |
| 3056 push_properties_count_++; | 3056 push_properties_count_++; |
| 3057 if (persist_needs_push_properties_) { | 3057 if (persist_needs_push_properties_) { |
| 3058 layer_tree_host()->AddLayerShouldPushProperties(this); | 3058 GetLayerTree()->AddLayerShouldPushProperties(this); |
| 3059 } | 3059 } |
| 3060 } | 3060 } |
| 3061 | 3061 |
| 3062 // Something to make this layer push properties, but no other layer. | 3062 // Something to make this layer push properties, but no other layer. |
| 3063 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } | 3063 void MakePushProperties() { SetContentsOpaque(!contents_opaque()); } |
| 3064 | 3064 |
| 3065 std::unique_ptr<LayerImpl> CreateLayerImpl( | 3065 std::unique_ptr<LayerImpl> CreateLayerImpl( |
| 3066 LayerTreeImpl* tree_impl) override { | 3066 LayerTreeImpl* tree_impl) override { |
| 3067 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); | 3067 return PushPropertiesCountingLayerImpl::Create(tree_impl, id()); |
| 3068 } | 3068 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3135 other_root_->push_properties_count()) | 3135 other_root_->push_properties_count()) |
| 3136 << "num_commits: " << num_commits_; | 3136 << "num_commits: " << num_commits_; |
| 3137 EXPECT_EQ(expected_push_properties_leaf_layer_, | 3137 EXPECT_EQ(expected_push_properties_leaf_layer_, |
| 3138 leaf_always_pushing_layer_->push_properties_count()) | 3138 leaf_always_pushing_layer_->push_properties_count()) |
| 3139 << "num_commits: " << num_commits_; | 3139 << "num_commits: " << num_commits_; |
| 3140 | 3140 |
| 3141 ++num_commits_; | 3141 ++num_commits_; |
| 3142 | 3142 |
| 3143 // The scrollbar layer always needs to be pushed. | 3143 // The scrollbar layer always needs to be pushed. |
| 3144 if (root_->layer_tree_host()) { | 3144 if (root_->layer_tree_host()) { |
| 3145 EXPECT_FALSE(root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3145 EXPECT_FALSE(root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3146 root_.get())); | 3146 root_.get())); |
| 3147 } | 3147 } |
| 3148 if (child2_->layer_tree_host()) { | 3148 if (child2_->layer_tree_host()) { |
| 3149 EXPECT_FALSE( | 3149 EXPECT_FALSE(child2_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3150 child2_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3150 child2_.get())); |
| 3151 child2_.get())); | |
| 3152 } | 3151 } |
| 3153 if (leaf_always_pushing_layer_->layer_tree_host()) { | 3152 if (leaf_always_pushing_layer_->layer_tree_host()) { |
| 3154 EXPECT_TRUE(leaf_always_pushing_layer_->layer_tree_host() | 3153 EXPECT_TRUE(leaf_always_pushing_layer_->GetLayerTree() |
| 3155 ->LayerNeedsPushPropertiesForTesting( | 3154 ->LayerNeedsPushPropertiesForTesting( |
| 3156 leaf_always_pushing_layer_.get())); | 3155 leaf_always_pushing_layer_.get())); |
| 3157 } | 3156 } |
| 3158 | 3157 |
| 3159 // child_ and grandchild_ don't persist their need to push properties. | 3158 // child_ and grandchild_ don't persist their need to push properties. |
| 3160 if (child_->layer_tree_host()) { | 3159 if (child_->layer_tree_host()) { |
| 3161 EXPECT_FALSE( | 3160 EXPECT_FALSE(child_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3162 child_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3161 child_.get())); |
| 3163 child_.get())); | |
| 3164 } | 3162 } |
| 3165 if (grandchild_->layer_tree_host()) { | 3163 if (grandchild_->layer_tree_host()) { |
| 3166 EXPECT_FALSE( | 3164 EXPECT_FALSE( |
| 3167 grandchild_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3165 grandchild_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3168 grandchild_.get())); | 3166 grandchild_.get())); |
| 3169 } | 3167 } |
| 3170 | 3168 |
| 3171 if (other_root_->layer_tree_host()) { | 3169 if (other_root_->layer_tree_host()) { |
| 3172 EXPECT_FALSE( | 3170 EXPECT_FALSE( |
| 3173 other_root_->layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3171 other_root_->GetLayerTree()->LayerNeedsPushPropertiesForTesting( |
| 3174 other_root_.get())); | 3172 other_root_.get())); |
| 3175 } | 3173 } |
| 3176 | 3174 |
| 3177 switch (num_commits_) { | 3175 switch (num_commits_) { |
| 3178 case 1: | 3176 case 1: |
| 3179 layer_tree_host()->SetRootLayer(root_); | 3177 layer_tree_host()->SetRootLayer(root_); |
| 3180 // Layers added to the tree get committed. | 3178 // Layers added to the tree get committed. |
| 3181 ++expected_push_properties_root_; | 3179 ++expected_push_properties_root_; |
| 3182 ++expected_push_properties_child_; | 3180 ++expected_push_properties_child_; |
| 3183 ++expected_push_properties_grandchild_; | 3181 ++expected_push_properties_grandchild_; |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3515 case 1: { | 3513 case 1: { |
| 3516 // During update, the ignore_set_needs_commit_ bit is set to true to | 3514 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3517 // avoid causing a second commit to be scheduled. If a property change | 3515 // avoid causing a second commit to be scheduled. If a property change |
| 3518 // is made during this, however, it needs to be pushed in the upcoming | 3516 // is made during this, however, it needs to be pushed in the upcoming |
| 3519 // commit. | 3517 // commit. |
| 3520 std::unique_ptr<base::AutoReset<bool>> ignore = | 3518 std::unique_ptr<base::AutoReset<bool>> ignore = |
| 3521 scrollbar_layer_->IgnoreSetNeedsCommit(); | 3519 scrollbar_layer_->IgnoreSetNeedsCommit(); |
| 3522 | 3520 |
| 3523 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); | 3521 scrollbar_layer_->SetBounds(gfx::Size(30, 30)); |
| 3524 | 3522 |
| 3525 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3523 EXPECT_TRUE( |
| 3526 scrollbar_layer_.get())); | 3524 layer_tree_host() |
| 3525 ->GetLayerTree() |
| 3526 ->LayerNeedsPushPropertiesForTesting(scrollbar_layer_.get())); |
| 3527 layer_tree_host()->SetNeedsCommit(); | 3527 layer_tree_host()->SetNeedsCommit(); |
| 3528 | 3528 |
| 3529 scrollbar_layer_->reset_push_properties_count(); | 3529 scrollbar_layer_->reset_push_properties_count(); |
| 3530 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); | 3530 EXPECT_EQ(0u, scrollbar_layer_->push_properties_count()); |
| 3531 break; | 3531 break; |
| 3532 } | 3532 } |
| 3533 case 2: | 3533 case 2: |
| 3534 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); | 3534 EXPECT_EQ(1u, scrollbar_layer_->push_properties_count()); |
| 3535 EndTest(); | 3535 EndTest(); |
| 3536 break; | 3536 break; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3552 void SetupTree() override { | 3552 void SetupTree() override { |
| 3553 root_ = PushPropertiesCountingLayer::Create(); | 3553 root_ = PushPropertiesCountingLayer::Create(); |
| 3554 child_ = PushPropertiesCountingLayer::Create(); | 3554 child_ = PushPropertiesCountingLayer::Create(); |
| 3555 root_->AddChild(child_); | 3555 root_->AddChild(child_); |
| 3556 | 3556 |
| 3557 layer_tree_host()->SetRootLayer(root_); | 3557 layer_tree_host()->SetRootLayer(root_); |
| 3558 LayerTreeHostTest::SetupTree(); | 3558 LayerTreeHostTest::SetupTree(); |
| 3559 } | 3559 } |
| 3560 | 3560 |
| 3561 void DidCommitAndDrawFrame() override { | 3561 void DidCommitAndDrawFrame() override { |
| 3562 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3562 switch (layer_tree_host()->source_frame_number()) { | 3563 switch (layer_tree_host()->source_frame_number()) { |
| 3563 case 0: | 3564 case 0: |
| 3564 break; | 3565 break; |
| 3565 case 1: { | 3566 case 1: { |
| 3566 // During update, the ignore_set_needs_commit_ bit is set to true to | 3567 // During update, the ignore_set_needs_commit_ bit is set to true to |
| 3567 // avoid causing a second commit to be scheduled. If a property change | 3568 // avoid causing a second commit to be scheduled. If a property change |
| 3568 // is made during this, however, it needs to be pushed in the upcoming | 3569 // is made during this, however, it needs to be pushed in the upcoming |
| 3569 // commit. | 3570 // commit. |
| 3570 EXPECT_FALSE( | 3571 EXPECT_FALSE( |
| 3571 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3572 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3572 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3573 EXPECT_FALSE( |
| 3573 child_.get())); | 3574 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3574 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); | 3575 EXPECT_EQ(0, root_->NumDescendantsThatDrawContent()); |
| 3575 root_->reset_push_properties_count(); | 3576 root_->reset_push_properties_count(); |
| 3576 child_->reset_push_properties_count(); | 3577 child_->reset_push_properties_count(); |
| 3577 child_->SetDrawsContent(true); | 3578 child_->SetDrawsContent(true); |
| 3578 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); | 3579 EXPECT_EQ(1, root_->NumDescendantsThatDrawContent()); |
| 3579 EXPECT_EQ(0u, root_->push_properties_count()); | 3580 EXPECT_EQ(0u, root_->push_properties_count()); |
| 3580 EXPECT_EQ(0u, child_->push_properties_count()); | 3581 EXPECT_EQ(0u, child_->push_properties_count()); |
| 3581 EXPECT_TRUE( | 3582 EXPECT_TRUE( |
| 3582 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3583 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3583 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3584 EXPECT_TRUE( |
| 3584 child_.get())); | 3585 |
| 3586 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3585 break; | 3587 break; |
| 3586 } | 3588 } |
| 3587 case 2: | 3589 case 2: |
| 3588 EXPECT_EQ(1u, root_->push_properties_count()); | 3590 EXPECT_EQ(1u, root_->push_properties_count()); |
| 3589 EXPECT_EQ(1u, child_->push_properties_count()); | 3591 EXPECT_EQ(1u, child_->push_properties_count()); |
| 3590 EXPECT_FALSE( | 3592 EXPECT_FALSE( |
| 3591 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3593 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3592 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3594 EXPECT_FALSE( |
| 3593 child_.get())); | 3595 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3594 EndTest(); | 3596 EndTest(); |
| 3595 break; | 3597 break; |
| 3596 } | 3598 } |
| 3597 } | 3599 } |
| 3598 | 3600 |
| 3599 void AfterTest() override {} | 3601 void AfterTest() override {} |
| 3600 | 3602 |
| 3601 scoped_refptr<PushPropertiesCountingLayer> root_; | 3603 scoped_refptr<PushPropertiesCountingLayer> root_; |
| 3602 scoped_refptr<PushPropertiesCountingLayer> child_; | 3604 scoped_refptr<PushPropertiesCountingLayer> child_; |
| 3603 }; | 3605 }; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3650 | 3652 |
| 3651 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush | 3653 class LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush |
| 3652 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3654 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3653 protected: | 3655 protected: |
| 3654 void DidCommitAndDrawFrame() override { | 3656 void DidCommitAndDrawFrame() override { |
| 3655 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3657 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3656 switch (last_source_frame_number) { | 3658 switch (last_source_frame_number) { |
| 3657 case 0: | 3659 case 0: |
| 3658 // All layers will need push properties as we set their layer tree host | 3660 // All layers will need push properties as we set their layer tree host |
| 3659 layer_tree_host()->SetRootLayer(root_); | 3661 layer_tree_host()->SetRootLayer(root_); |
| 3662 EXPECT_TRUE(layer_tree_host() |
| 3663 ->GetLayerTree() |
| 3664 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3665 EXPECT_TRUE(layer_tree_host() |
| 3666 ->GetLayerTree() |
| 3667 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3660 EXPECT_TRUE( | 3668 EXPECT_TRUE( |
| 3661 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3669 layer_tree_host() |
| 3662 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3670 ->GetLayerTree() |
| 3663 child_.get())); | 3671 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3664 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3672 EXPECT_TRUE( |
| 3665 grandchild1_.get())); | 3673 layer_tree_host() |
| 3666 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3674 ->GetLayerTree() |
| 3667 grandchild2_.get())); | 3675 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3668 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3676 EXPECT_TRUE( |
| 3669 grandchild3_.get())); | 3677 layer_tree_host() |
| 3678 ->GetLayerTree() |
| 3679 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3670 break; | 3680 break; |
| 3671 case 1: | 3681 case 1: |
| 3672 EndTest(); | 3682 EndTest(); |
| 3673 break; | 3683 break; |
| 3674 } | 3684 } |
| 3675 } | 3685 } |
| 3676 }; | 3686 }; |
| 3677 | 3687 |
| 3678 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); | 3688 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesAddingToTreeRequiresPush); |
| 3679 | 3689 |
| 3680 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion | 3690 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion |
| 3681 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3691 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3682 protected: | 3692 protected: |
| 3683 void DidCommitAndDrawFrame() override { | 3693 void DidCommitAndDrawFrame() override { |
| 3684 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3694 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3685 switch (last_source_frame_number) { | 3695 switch (last_source_frame_number) { |
| 3686 case 0: | 3696 case 0: |
| 3687 layer_tree_host()->SetRootLayer(root_); | 3697 layer_tree_host()->SetRootLayer(root_); |
| 3688 break; | 3698 break; |
| 3689 case 1: | 3699 case 1: |
| 3700 EXPECT_FALSE(layer_tree_host() |
| 3701 ->GetLayerTree() |
| 3702 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3703 EXPECT_FALSE(layer_tree_host() |
| 3704 ->GetLayerTree() |
| 3705 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3690 EXPECT_FALSE( | 3706 EXPECT_FALSE( |
| 3691 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3707 layer_tree_host() |
| 3692 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3708 ->GetLayerTree() |
| 3693 child_.get())); | 3709 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3694 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3710 EXPECT_FALSE( |
| 3695 grandchild1_.get())); | 3711 layer_tree_host() |
| 3696 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3712 ->GetLayerTree() |
| 3697 grandchild2_.get())); | 3713 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3698 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3714 EXPECT_FALSE( |
| 3699 grandchild3_.get())); | 3715 layer_tree_host() |
| 3716 ->GetLayerTree() |
| 3717 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3700 | 3718 |
| 3701 grandchild1_->RemoveFromParent(); | 3719 grandchild1_->RemoveFromParent(); |
| 3702 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3720 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3703 | 3721 |
| 3722 EXPECT_FALSE(layer_tree_host() |
| 3723 ->GetLayerTree() |
| 3724 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3725 EXPECT_FALSE(layer_tree_host() |
| 3726 ->GetLayerTree() |
| 3727 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3704 EXPECT_FALSE( | 3728 EXPECT_FALSE( |
| 3705 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3729 layer_tree_host() |
| 3706 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3730 ->GetLayerTree() |
| 3707 child_.get())); | 3731 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3708 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3732 EXPECT_FALSE( |
| 3709 grandchild2_.get())); | 3733 layer_tree_host() |
| 3710 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3734 ->GetLayerTree() |
| 3711 grandchild3_.get())); | 3735 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3712 | 3736 |
| 3713 child_->AddChild(grandchild1_); | 3737 child_->AddChild(grandchild1_); |
| 3714 | 3738 |
| 3739 EXPECT_FALSE(layer_tree_host() |
| 3740 ->GetLayerTree() |
| 3741 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3742 EXPECT_FALSE(layer_tree_host() |
| 3743 ->GetLayerTree() |
| 3744 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3745 EXPECT_TRUE( |
| 3746 layer_tree_host() |
| 3747 ->GetLayerTree() |
| 3748 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3715 EXPECT_FALSE( | 3749 EXPECT_FALSE( |
| 3716 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3750 layer_tree_host() |
| 3717 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3751 ->GetLayerTree() |
| 3718 child_.get())); | 3752 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3719 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3753 EXPECT_FALSE( |
| 3720 grandchild1_.get())); | 3754 layer_tree_host() |
| 3721 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3755 ->GetLayerTree() |
| 3722 grandchild2_.get())); | 3756 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3723 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
| 3724 grandchild3_.get())); | |
| 3725 | 3757 |
| 3726 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3758 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3727 | 3759 |
| 3760 EXPECT_FALSE(layer_tree_host() |
| 3761 ->GetLayerTree() |
| 3762 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3763 EXPECT_FALSE(layer_tree_host() |
| 3764 ->GetLayerTree() |
| 3765 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3766 EXPECT_TRUE( |
| 3767 layer_tree_host() |
| 3768 ->GetLayerTree() |
| 3769 ->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3770 EXPECT_TRUE( |
| 3771 layer_tree_host() |
| 3772 ->GetLayerTree() |
| 3773 ->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3728 EXPECT_FALSE( | 3774 EXPECT_FALSE( |
| 3729 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3775 layer_tree_host() |
| 3730 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3776 ->GetLayerTree() |
| 3731 child_.get())); | 3777 ->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3732 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
| 3733 grandchild1_.get())); | |
| 3734 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
| 3735 grandchild2_.get())); | |
| 3736 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | |
| 3737 grandchild3_.get())); | |
| 3738 | 3778 |
| 3739 // grandchild2_ will still need a push properties. | 3779 // grandchild2_ will still need a push properties. |
| 3740 grandchild1_->RemoveFromParent(); | 3780 grandchild1_->RemoveFromParent(); |
| 3741 | 3781 |
| 3742 EXPECT_FALSE( | 3782 EXPECT_FALSE(layer_tree_host() |
| 3743 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3783 ->GetLayerTree() |
| 3744 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3784 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3745 child_.get())); | 3785 EXPECT_FALSE(layer_tree_host() |
| 3786 ->GetLayerTree() |
| 3787 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3746 | 3788 |
| 3747 // grandchild3_ does not need a push properties, so recursing should | 3789 // grandchild3_ does not need a push properties, so recursing should |
| 3748 // no longer be needed. | 3790 // no longer be needed. |
| 3749 grandchild2_->RemoveFromParent(); | 3791 grandchild2_->RemoveFromParent(); |
| 3750 | 3792 |
| 3751 EXPECT_FALSE( | 3793 EXPECT_FALSE(layer_tree_host() |
| 3752 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3794 ->GetLayerTree() |
| 3753 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3795 ->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3754 child_.get())); | 3796 EXPECT_FALSE(layer_tree_host() |
| 3797 ->GetLayerTree() |
| 3798 ->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3755 EndTest(); | 3799 EndTest(); |
| 3756 break; | 3800 break; |
| 3757 } | 3801 } |
| 3758 } | 3802 } |
| 3759 }; | 3803 }; |
| 3760 | 3804 |
| 3761 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); | 3805 MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesRemovingChildStopsRecursion); |
| 3762 | 3806 |
| 3763 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence | 3807 class LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence |
| 3764 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3808 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3765 protected: | 3809 protected: |
| 3766 void DidCommitAndDrawFrame() override { | 3810 void DidCommitAndDrawFrame() override { |
| 3811 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3767 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3812 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3768 switch (last_source_frame_number) { | 3813 switch (last_source_frame_number) { |
| 3769 case 0: | 3814 case 0: |
| 3770 layer_tree_host()->SetRootLayer(root_); | 3815 layer_tree_host()->SetRootLayer(root_); |
| 3771 grandchild1_->set_persist_needs_push_properties(true); | 3816 grandchild1_->set_persist_needs_push_properties(true); |
| 3772 grandchild2_->set_persist_needs_push_properties(true); | 3817 grandchild2_->set_persist_needs_push_properties(true); |
| 3773 break; | 3818 break; |
| 3774 case 1: | 3819 case 1: |
| 3775 EXPECT_FALSE( | 3820 EXPECT_FALSE( |
| 3776 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3821 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3777 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3822 EXPECT_FALSE( |
| 3778 child_.get())); | 3823 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3779 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3824 EXPECT_TRUE( |
| 3780 grandchild1_.get())); | 3825 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3781 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3826 EXPECT_TRUE( |
| 3782 grandchild2_.get())); | 3827 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3783 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3828 EXPECT_FALSE( |
| 3784 grandchild3_.get())); | 3829 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3785 | 3830 |
| 3786 // grandchild2_ will still need a push properties. | 3831 // grandchild2_ will still need a push properties. |
| 3787 grandchild1_->RemoveFromParent(); | 3832 grandchild1_->RemoveFromParent(); |
| 3788 | 3833 |
| 3789 EXPECT_FALSE( | 3834 EXPECT_FALSE( |
| 3790 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3835 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3791 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3836 EXPECT_FALSE( |
| 3792 child_.get())); | 3837 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3793 | 3838 |
| 3794 // grandchild3_ does not need a push properties, so recursing should | 3839 // grandchild3_ does not need a push properties, so recursing should |
| 3795 // no longer be needed. | 3840 // no longer be needed. |
| 3796 grandchild2_->RemoveFromParent(); | 3841 grandchild2_->RemoveFromParent(); |
| 3797 | 3842 |
| 3798 EXPECT_FALSE( | 3843 EXPECT_FALSE( |
| 3799 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3844 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3800 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3845 EXPECT_FALSE( |
| 3801 child_.get())); | 3846 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3802 EndTest(); | 3847 EndTest(); |
| 3803 break; | 3848 break; |
| 3804 } | 3849 } |
| 3805 } | 3850 } |
| 3806 }; | 3851 }; |
| 3807 | 3852 |
| 3808 MULTI_THREAD_TEST_F( | 3853 MULTI_THREAD_TEST_F( |
| 3809 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); | 3854 LayerTreeHostTestPushPropertiesRemovingChildStopsRecursionWithPersistence); |
| 3810 | 3855 |
| 3811 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree | 3856 class LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree |
| 3812 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3857 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3813 protected: | 3858 protected: |
| 3814 void DidCommitAndDrawFrame() override { | 3859 void DidCommitAndDrawFrame() override { |
| 3860 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3815 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3861 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3816 switch (last_source_frame_number) { | 3862 switch (last_source_frame_number) { |
| 3817 case 0: | 3863 case 0: |
| 3818 layer_tree_host()->SetRootLayer(root_); | 3864 layer_tree_host()->SetRootLayer(root_); |
| 3819 break; | 3865 break; |
| 3820 case 1: | 3866 case 1: |
| 3821 EXPECT_FALSE( | 3867 EXPECT_FALSE( |
| 3822 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3868 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3823 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3869 EXPECT_FALSE( |
| 3824 child_.get())); | 3870 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3825 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3871 EXPECT_FALSE( |
| 3826 grandchild1_.get())); | 3872 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3827 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3873 EXPECT_FALSE( |
| 3828 grandchild2_.get())); | 3874 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3829 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3875 EXPECT_FALSE( |
| 3830 grandchild3_.get())); | 3876 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3831 | 3877 |
| 3832 // Change grandchildren while their parent is not in the tree. | 3878 // Change grandchildren while their parent is not in the tree. |
| 3833 child_->RemoveFromParent(); | 3879 child_->RemoveFromParent(); |
| 3834 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3880 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3835 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3881 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3836 root_->AddChild(child_); | 3882 root_->AddChild(child_); |
| 3837 | 3883 |
| 3838 EXPECT_FALSE( | 3884 EXPECT_FALSE( |
| 3839 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3885 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3840 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3886 EXPECT_TRUE( |
| 3841 child_.get())); | 3887 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3842 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3888 EXPECT_TRUE( |
| 3843 grandchild1_.get())); | 3889 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3844 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3890 EXPECT_TRUE( |
| 3845 grandchild2_.get())); | 3891 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3846 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3892 EXPECT_TRUE( |
| 3847 grandchild3_.get())); | 3893 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3848 | 3894 |
| 3849 grandchild1_->RemoveFromParent(); | 3895 grandchild1_->RemoveFromParent(); |
| 3850 | 3896 |
| 3851 EXPECT_FALSE( | 3897 EXPECT_FALSE( |
| 3852 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3898 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3853 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3899 EXPECT_TRUE( |
| 3854 child_.get())); | 3900 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3855 | 3901 |
| 3856 grandchild2_->RemoveFromParent(); | 3902 grandchild2_->RemoveFromParent(); |
| 3857 | 3903 |
| 3858 EXPECT_FALSE( | 3904 EXPECT_FALSE( |
| 3859 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3905 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3860 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3906 EXPECT_TRUE( |
| 3861 child_.get())); | 3907 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3862 | 3908 |
| 3863 grandchild3_->RemoveFromParent(); | 3909 grandchild3_->RemoveFromParent(); |
| 3864 | 3910 |
| 3865 EXPECT_FALSE( | 3911 EXPECT_FALSE( |
| 3866 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3912 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3867 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3913 EXPECT_TRUE( |
| 3868 child_.get())); | 3914 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3869 | 3915 |
| 3870 EndTest(); | 3916 EndTest(); |
| 3871 break; | 3917 break; |
| 3872 } | 3918 } |
| 3873 } | 3919 } |
| 3874 }; | 3920 }; |
| 3875 | 3921 |
| 3876 MULTI_THREAD_TEST_F( | 3922 MULTI_THREAD_TEST_F( |
| 3877 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); | 3923 LayerTreeHostTestPushPropertiesSetPropertiesWhileOutsideTree); |
| 3878 | 3924 |
| 3879 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild | 3925 class LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild |
| 3880 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3926 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3881 protected: | 3927 protected: |
| 3882 void DidCommitAndDrawFrame() override { | 3928 void DidCommitAndDrawFrame() override { |
| 3929 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3883 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3930 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3884 switch (last_source_frame_number) { | 3931 switch (last_source_frame_number) { |
| 3885 case 0: | 3932 case 0: |
| 3886 layer_tree_host()->SetRootLayer(root_); | 3933 layer_tree_host()->SetRootLayer(root_); |
| 3887 break; | 3934 break; |
| 3888 case 1: | 3935 case 1: |
| 3889 EXPECT_FALSE( | 3936 EXPECT_FALSE( |
| 3890 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3937 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3891 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3938 EXPECT_FALSE( |
| 3892 child_.get())); | 3939 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3893 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3940 EXPECT_FALSE( |
| 3894 grandchild1_.get())); | 3941 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3895 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3942 EXPECT_FALSE( |
| 3896 grandchild2_.get())); | 3943 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3897 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3944 EXPECT_FALSE( |
| 3898 grandchild3_.get())); | 3945 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3899 | 3946 |
| 3900 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 3947 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3901 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 3948 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3902 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 3949 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3903 | 3950 |
| 3904 EXPECT_FALSE( | 3951 EXPECT_FALSE( |
| 3905 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3952 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3906 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3953 EXPECT_TRUE( |
| 3907 child_.get())); | 3954 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3908 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3955 EXPECT_TRUE( |
| 3909 grandchild1_.get())); | 3956 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3910 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3957 EXPECT_TRUE( |
| 3911 grandchild2_.get())); | 3958 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3912 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3959 EXPECT_FALSE( |
| 3913 grandchild3_.get())); | 3960 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3914 | 3961 |
| 3915 grandchild1_->RemoveFromParent(); | 3962 grandchild1_->RemoveFromParent(); |
| 3916 | 3963 |
| 3917 EXPECT_FALSE( | 3964 EXPECT_FALSE( |
| 3918 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3965 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3919 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3966 EXPECT_TRUE( |
| 3920 child_.get())); | 3967 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3921 | 3968 |
| 3922 grandchild2_->RemoveFromParent(); | 3969 grandchild2_->RemoveFromParent(); |
| 3923 | 3970 |
| 3924 EXPECT_FALSE( | 3971 EXPECT_FALSE( |
| 3925 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3972 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3926 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 3973 EXPECT_TRUE( |
| 3927 child_.get())); | 3974 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3928 | 3975 |
| 3929 child_->RemoveFromParent(); | 3976 child_->RemoveFromParent(); |
| 3930 | 3977 |
| 3931 EXPECT_FALSE( | 3978 EXPECT_FALSE( |
| 3932 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 3979 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3933 | 3980 |
| 3934 EndTest(); | 3981 EndTest(); |
| 3935 break; | 3982 break; |
| 3936 } | 3983 } |
| 3937 } | 3984 } |
| 3938 }; | 3985 }; |
| 3939 | 3986 |
| 3940 MULTI_THREAD_TEST_F( | 3987 MULTI_THREAD_TEST_F( |
| 3941 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); | 3988 LayerTreeHostTestPushPropertiesSetPropertyInParentThenChild); |
| 3942 | 3989 |
| 3943 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent | 3990 class LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent |
| 3944 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { | 3991 : public LayerTreeHostTestCasePushPropertiesThreeGrandChildren { |
| 3945 protected: | 3992 protected: |
| 3946 void DidCommitAndDrawFrame() override { | 3993 void DidCommitAndDrawFrame() override { |
| 3994 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 3947 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; | 3995 int last_source_frame_number = layer_tree_host()->source_frame_number() - 1; |
| 3948 switch (last_source_frame_number) { | 3996 switch (last_source_frame_number) { |
| 3949 case 0: | 3997 case 0: |
| 3950 layer_tree_host()->SetRootLayer(root_); | 3998 layer_tree_host()->SetRootLayer(root_); |
| 3951 break; | 3999 break; |
| 3952 case 1: | 4000 case 1: |
| 3953 EXPECT_FALSE( | 4001 EXPECT_FALSE( |
| 3954 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4002 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3955 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4003 EXPECT_FALSE( |
| 3956 child_.get())); | 4004 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3957 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4005 EXPECT_FALSE( |
| 3958 grandchild1_.get())); | 4006 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3959 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4007 EXPECT_FALSE( |
| 3960 grandchild2_.get())); | 4008 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3961 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4009 EXPECT_FALSE( |
| 3962 grandchild3_.get())); | 4010 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3963 | 4011 |
| 3964 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); | 4012 grandchild1_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3965 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); | 4013 grandchild2_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3966 child_->SetPosition(gfx::PointF(1.f, 1.f)); | 4014 child_->SetPosition(gfx::PointF(1.f, 1.f)); |
| 3967 | 4015 |
| 3968 EXPECT_FALSE( | 4016 EXPECT_FALSE( |
| 3969 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4017 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3970 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4018 EXPECT_TRUE( |
| 3971 child_.get())); | 4019 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3972 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4020 EXPECT_TRUE( |
| 3973 grandchild1_.get())); | 4021 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild1_.get())); |
| 3974 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4022 EXPECT_TRUE( |
| 3975 grandchild2_.get())); | 4023 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild2_.get())); |
| 3976 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4024 EXPECT_FALSE( |
| 3977 grandchild3_.get())); | 4025 layer_tree->LayerNeedsPushPropertiesForTesting(grandchild3_.get())); |
| 3978 | 4026 |
| 3979 grandchild1_->RemoveFromParent(); | 4027 grandchild1_->RemoveFromParent(); |
| 3980 | 4028 |
| 3981 EXPECT_FALSE( | 4029 EXPECT_FALSE( |
| 3982 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4030 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3983 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4031 EXPECT_TRUE( |
| 3984 child_.get())); | 4032 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3985 | 4033 |
| 3986 grandchild2_->RemoveFromParent(); | 4034 grandchild2_->RemoveFromParent(); |
| 3987 | 4035 |
| 3988 EXPECT_FALSE( | 4036 EXPECT_FALSE( |
| 3989 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4037 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3990 EXPECT_TRUE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4038 EXPECT_TRUE( |
| 3991 child_.get())); | 4039 layer_tree->LayerNeedsPushPropertiesForTesting(child_.get())); |
| 3992 | 4040 |
| 3993 child_->RemoveFromParent(); | 4041 child_->RemoveFromParent(); |
| 3994 | 4042 |
| 3995 EXPECT_FALSE( | 4043 EXPECT_FALSE( |
| 3996 layer_tree_host()->LayerNeedsPushPropertiesForTesting(root_.get())); | 4044 layer_tree->LayerNeedsPushPropertiesForTesting(root_.get())); |
| 3997 | 4045 |
| 3998 EndTest(); | 4046 EndTest(); |
| 3999 break; | 4047 break; |
| 4000 } | 4048 } |
| 4001 } | 4049 } |
| 4002 }; | 4050 }; |
| 4003 | 4051 |
| 4004 MULTI_THREAD_TEST_F( | 4052 MULTI_THREAD_TEST_F( |
| 4005 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); | 4053 LayerTreeHostTestPushPropertiesSetPropertyInChildThenParent); |
| 4006 | 4054 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4146 child_layer_->SetIsDrawable(true); | 4194 child_layer_->SetIsDrawable(true); |
| 4147 parent_layer_->AddChild(child_layer_); | 4195 parent_layer_->AddChild(child_layer_); |
| 4148 | 4196 |
| 4149 layer_tree_host()->SetRootLayer(root_layer_); | 4197 layer_tree_host()->SetRootLayer(root_layer_); |
| 4150 LayerTreeHostTest::SetupTree(); | 4198 LayerTreeHostTest::SetupTree(); |
| 4151 } | 4199 } |
| 4152 | 4200 |
| 4153 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 4201 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 4154 | 4202 |
| 4155 void DidCommitAndDrawFrame() override { | 4203 void DidCommitAndDrawFrame() override { |
| 4204 LayerTree* layer_tree = layer_tree_host()->GetLayerTree(); |
| 4156 switch (layer_tree_host()->source_frame_number()) { | 4205 switch (layer_tree_host()->source_frame_number()) { |
| 4157 case 1: | 4206 case 1: |
| 4158 // The layer type used does not need to push properties every frame. | 4207 // The layer type used does not need to push properties every frame. |
| 4159 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4208 EXPECT_FALSE( |
| 4160 child_layer_.get())); | 4209 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); |
| 4161 | 4210 |
| 4162 // Change the bounds of the child layer, but make it skipped | 4211 // Change the bounds of the child layer, but make it skipped |
| 4163 // by CalculateDrawProperties. | 4212 // by CalculateDrawProperties. |
| 4164 parent_layer_->SetOpacity(0.f); | 4213 parent_layer_->SetOpacity(0.f); |
| 4165 child_layer_->SetBounds(gfx::Size(5, 5)); | 4214 child_layer_->SetBounds(gfx::Size(5, 5)); |
| 4166 break; | 4215 break; |
| 4167 case 2: | 4216 case 2: |
| 4168 // The bounds of the child layer were pushed to the impl side. | 4217 // The bounds of the child layer were pushed to the impl side. |
| 4169 EXPECT_FALSE(layer_tree_host()->LayerNeedsPushPropertiesForTesting( | 4218 EXPECT_FALSE( |
| 4170 child_layer_.get())); | 4219 layer_tree->LayerNeedsPushPropertiesForTesting(child_layer_.get())); |
| 4171 | 4220 |
| 4172 EndTest(); | 4221 EndTest(); |
| 4173 break; | 4222 break; |
| 4174 } | 4223 } |
| 4175 } | 4224 } |
| 4176 | 4225 |
| 4177 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { | 4226 void DidActivateTreeOnThread(LayerTreeHostImpl* impl) override { |
| 4178 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); | 4227 LayerImpl* child = impl->active_tree()->LayerById(child_layer_->id()); |
| 4179 | 4228 |
| 4180 switch (impl->active_tree()->source_frame_number()) { | 4229 switch (impl->active_tree()->source_frame_number()) { |
| (...skipping 2711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6892 private: | 6941 private: |
| 6893 FakeContentLayerClient client_; | 6942 FakeContentLayerClient client_; |
| 6894 const gfx::Size viewport_size_; | 6943 const gfx::Size viewport_size_; |
| 6895 const gfx::Size large_image_size_; | 6944 const gfx::Size large_image_size_; |
| 6896 }; | 6945 }; |
| 6897 | 6946 |
| 6898 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); | 6947 SINGLE_AND_MULTI_THREAD_TEST_F(GpuRasterizationSucceedsWithLargeImage); |
| 6899 | 6948 |
| 6900 } // namespace | 6949 } // namespace |
| 6901 } // namespace cc | 6950 } // namespace cc |
| OLD | NEW |