Chromium Code Reviews| 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 int index_; | 685 int index_; |
| 686 }; | 686 }; |
| 687 | 687 |
| 688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); | 688 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPushPropertiesTo); |
| 689 | 689 |
| 690 // Verify damage status of property trees is preserved after commit. | 690 // Verify damage status of property trees is preserved after commit. |
| 691 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { | 691 class LayerTreeHostTestPropertyTreesChangedSync : public LayerTreeHostTest { |
| 692 protected: | 692 protected: |
| 693 void SetupTree() override { | 693 void SetupTree() override { |
| 694 scoped_refptr<Layer> root = Layer::Create(); | 694 scoped_refptr<Layer> root = Layer::Create(); |
| 695 scoped_refptr<Layer> child = Layer::Create(); | |
| 696 // This is to force the child to create a transform and effect node. | |
| 697 child->SetForceRenderSurface(true); | |
| 698 root->AddChild(std::move(child)); | |
| 695 layer_tree_host()->SetRootLayer(root); | 699 layer_tree_host()->SetRootLayer(root); |
| 696 LayerTreeHostTest::SetupTree(); | 700 LayerTreeHostTest::SetupTree(); |
| 697 } | 701 } |
| 698 | 702 |
| 699 enum Animations { | 703 enum Animations { |
| 700 OPACITY, | 704 OPACITY, |
| 701 TRANSFORM, | 705 TRANSFORM, |
| 702 FILTER, | 706 FILTER, |
| 703 END, | 707 END, |
| 704 }; | 708 }; |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 718 PropertyTrees::ResetFlags::ALL_TREES); | 722 PropertyTrees::ResetFlags::ALL_TREES); |
| 719 impl->active_tree()->root_layer()->OnOpacityAnimated(0.5f); | 723 impl->active_tree()->root_layer()->OnOpacityAnimated(0.5f); |
| 720 PostSetNeedsCommitToMainThread(); | 724 PostSetNeedsCommitToMainThread(); |
| 721 break; | 725 break; |
| 722 case TRANSFORM: | 726 case TRANSFORM: |
| 723 index_++; | 727 index_++; |
| 724 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 728 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 725 impl->active_tree()->ResetAllChangeTracking( | 729 impl->active_tree()->ResetAllChangeTracking( |
| 726 PropertyTrees::ResetFlags::EFFECT_TREE); | 730 PropertyTrees::ResetFlags::EFFECT_TREE); |
| 727 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 731 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 732 EXPECT_FALSE(impl->active_tree() | |
| 733 ->root_layer() | |
| 734 ->child_at(0) | |
| 735 ->LayerPropertyChanged()); | |
| 728 transform.Translate(10, 10); | 736 transform.Translate(10, 10); |
| 729 impl->active_tree()->root_layer()->OnTransformAnimated(transform); | 737 impl->active_tree()->root_layer()->OnTransformAnimated(transform); |
| 738 // We rebuild property trees on main thread to test the code path of | |
| 739 // damage status synchronization when property trees are different. | |
| 740 layer_tree_host()->property_trees()->needs_rebuild = true; | |
|
ajuma
2016/03/24 23:55:53
This is accessing the LayerTreeHost from the compo
jaydasika
2016/03/25 00:05:25
Done.
| |
| 730 PostSetNeedsCommitToMainThread(); | 741 PostSetNeedsCommitToMainThread(); |
| 731 break; | 742 break; |
| 732 case FILTER: | 743 case FILTER: |
| 733 index_++; | 744 index_++; |
| 734 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 745 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 746 EXPECT_TRUE(impl->active_tree() | |
| 747 ->root_layer() | |
| 748 ->child_at(0) | |
| 749 ->LayerPropertyChanged()); | |
| 735 impl->active_tree()->ResetAllChangeTracking( | 750 impl->active_tree()->ResetAllChangeTracking( |
| 736 PropertyTrees::ResetFlags::TRANSFORM_TREE); | 751 PropertyTrees::ResetFlags::TRANSFORM_TREE); |
| 737 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 752 EXPECT_FALSE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 753 EXPECT_FALSE(impl->active_tree() | |
| 754 ->root_layer() | |
| 755 ->child_at(0) | |
| 756 ->LayerPropertyChanged()); | |
| 738 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); | 757 filters.Append(FilterOperation::CreateOpacityFilter(0.5f)); |
| 739 impl->active_tree()->root_layer()->OnFilterAnimated(filters); | 758 impl->active_tree()->root_layer()->OnFilterAnimated(filters); |
| 740 PostSetNeedsCommitToMainThread(); | 759 PostSetNeedsCommitToMainThread(); |
| 741 break; | 760 break; |
| 742 case END: | 761 case END: |
| 743 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); | 762 EXPECT_TRUE(impl->active_tree()->root_layer()->LayerPropertyChanged()); |
| 744 EndTest(); | 763 EndTest(); |
| 745 break; | 764 break; |
| 746 } | 765 } |
| 747 } | 766 } |
| (...skipping 5903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6651 EndTest(); | 6670 EndTest(); |
| 6652 } | 6671 } |
| 6653 | 6672 |
| 6654 void AfterTest() override {} | 6673 void AfterTest() override {} |
| 6655 }; | 6674 }; |
| 6656 | 6675 |
| 6657 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); | 6676 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestPaintedDeviceScaleFactor); |
| 6658 | 6677 |
| 6659 } // namespace | 6678 } // namespace |
| 6660 } // namespace cc | 6679 } // namespace cc |
| OLD | NEW |