Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "cc/animation/animation_curve.h" | 9 #include "cc/animation/animation_curve.h" |
| 10 #include "cc/animation/animation_host.h" | 10 #include "cc/animation/animation_host.h" |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1638 private: | 1638 private: |
| 1639 bool called_animation_started_; | 1639 bool called_animation_started_; |
| 1640 bool called_animation_finished_; | 1640 bool called_animation_finished_; |
| 1641 FakeContentLayerClient client_; | 1641 FakeContentLayerClient client_; |
| 1642 scoped_refptr<FakePictureLayer> picture_; | 1642 scoped_refptr<FakePictureLayer> picture_; |
| 1643 }; | 1643 }; |
| 1644 | 1644 |
| 1645 SINGLE_AND_MULTI_THREAD_TEST_F( | 1645 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 1646 LayerTreeHostAnimationTestNotifyAnimationFinished); | 1646 LayerTreeHostAnimationTestNotifyAnimationFinished); |
| 1647 | 1647 |
| 1648 // Check that transform sync happens correctly at commit when we remove and add | |
| 1649 // a different animation player to an element. | |
| 1650 class LayerTreeHostAnimationTestChangeAnimationPlayer | |
| 1651 : public LayerTreeHostAnimationTest { | |
| 1652 public: | |
| 1653 void SetupTree() override { | |
| 1654 LayerTreeHostAnimationTest::SetupTree(); | |
| 1655 AttachPlayersToTimeline(); | |
| 1656 timeline_->DetachPlayer(player_child_.get()); | |
| 1657 player_->AttachElement(layer_tree_host()->root_layer()->id()); | |
| 1658 AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5); | |
|
ajuma
2016/06/24 21:02:34
If you use the version of AddAnimatedTransformToPl
jaydasika
2016/06/24 21:54:44
Done.
| |
| 1659 } | |
| 1660 | |
| 1661 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | |
| 1662 | |
| 1663 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | |
| 1664 PropertyTrees* property_trees = host_impl->pending_tree()->property_trees(); | |
| 1665 TransformNode* node = property_trees->transform_tree.Node( | |
| 1666 host_impl->pending_tree()->root_layer()->transform_tree_index()); | |
| 1667 gfx::Transform rotate10; | |
| 1668 rotate10.Rotate(10); | |
| 1669 switch (host_impl->pending_tree()->source_frame_number()) { | |
| 1670 case 2: | |
| 1671 EXPECT_NE(node->data.local, rotate10); | |
| 1672 EndTest(); | |
| 1673 break; | |
| 1674 default: | |
| 1675 break; | |
| 1676 } | |
| 1677 } | |
| 1678 | |
| 1679 void DidCommit() override { PostSetNeedsCommitToMainThread(); } | |
| 1680 | |
| 1681 void UpdateLayerTreeHost() override { | |
|
ajuma
2016/06/24 21:02:34
How about doing this in WillBeginMainFrame? Then t
jaydasika
2016/06/24 21:54:44
Done.
| |
| 1682 if (layer_tree_host()->source_frame_number() == 2) { | |
| 1683 // Destroy player. | |
| 1684 timeline_->DetachPlayer(player_.get()); | |
| 1685 player_ = nullptr; | |
| 1686 timeline_->AttachPlayer(player_child_.get()); | |
| 1687 player_child_->AttachElement(layer_tree_host()->root_layer()->id()); | |
| 1688 AddAnimatedTransformToPlayer(player_child_.get(), 1.0, 5, 5); | |
| 1689 Animation* animation = player_child_->element_animations()->GetAnimation( | |
| 1690 TargetProperty::TRANSFORM); | |
| 1691 animation->set_start_time(base::TimeTicks::Now() + | |
| 1692 base::TimeDelta::FromSecondsD(1000)); | |
| 1693 animation->set_fill_mode(Animation::FillMode::NONE); | |
| 1694 animation->InEffect(base::TimeTicks::Now()); | |
|
jaydasika
2016/06/24 20:47:43
Will remove this.
| |
| 1695 gfx::Transform rotate10; | |
| 1696 rotate10.Rotate(10); | |
| 1697 layer_tree_host()->root_layer()->SetTransform(rotate10); | |
| 1698 } | |
| 1699 } | |
| 1700 | |
| 1701 void AfterTest() override {} | |
| 1702 }; | |
| 1703 | |
| 1704 MULTI_THREAD_TEST_F(LayerTreeHostAnimationTestChangeAnimationPlayer); | |
|
ajuma
2016/06/24 21:02:34
Can this be a single thread test too? (using sync_
jaydasika
2016/06/24 21:54:44
Done.
| |
| 1705 | |
| 1648 // Check that SetTransformIsPotentiallyAnimatingChanged is called | 1706 // Check that SetTransformIsPotentiallyAnimatingChanged is called |
| 1649 // if we destroy ElementAnimations. | 1707 // if we destroy ElementAnimations. |
| 1650 class LayerTreeHostAnimationTestSetPotentiallyAnimatingOnLacDestruction | 1708 class LayerTreeHostAnimationTestSetPotentiallyAnimatingOnLacDestruction |
| 1651 : public LayerTreeHostAnimationTest { | 1709 : public LayerTreeHostAnimationTest { |
| 1652 public: | 1710 public: |
| 1653 void SetupTree() override { | 1711 void SetupTree() override { |
| 1654 prev_screen_space_transform_is_animating_ = true; | 1712 prev_screen_space_transform_is_animating_ = true; |
| 1655 screen_space_transform_animation_stopped_ = false; | 1713 screen_space_transform_animation_stopped_ = false; |
| 1656 | 1714 |
| 1657 LayerTreeHostAnimationTest::SetupTree(); | 1715 LayerTreeHostAnimationTest::SetupTree(); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1771 private: | 1829 private: |
| 1772 scoped_refptr<Layer> layer_; | 1830 scoped_refptr<Layer> layer_; |
| 1773 FakeContentLayerClient client_; | 1831 FakeContentLayerClient client_; |
| 1774 }; | 1832 }; |
| 1775 | 1833 |
| 1776 MULTI_THREAD_TEST_F( | 1834 MULTI_THREAD_TEST_F( |
| 1777 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1835 LayerTreeHostAnimationTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1778 | 1836 |
| 1779 } // namespace | 1837 } // namespace |
| 1780 } // namespace cc | 1838 } // namespace cc |
| OLD | NEW |