| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "cc/animation/animation_curve.h" | 7 #include "cc/animation/animation_curve.h" |
| 8 #include "cc/animation/animation_host.h" | 8 #include "cc/animation/animation_host.h" |
| 9 #include "cc/animation/animation_id_provider.h" | 9 #include "cc/animation/animation_id_provider.h" |
| 10 #include "cc/animation/animation_player.h" | 10 #include "cc/animation/animation_player.h" |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 993 FakeContentLayerClient client_; | 993 FakeContentLayerClient client_; |
| 994 CompletionEvent completion_; | 994 CompletionEvent completion_; |
| 995 }; | 995 }; |
| 996 | 996 |
| 997 // An animation finishing during commit can only happen when we have a separate | 997 // An animation finishing during commit can only happen when we have a separate |
| 998 // compositor thread. | 998 // compositor thread. |
| 999 MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestAnimationFinishesDuringCommit); | 999 MULTI_THREAD_TEST_F(LayerTreeHostTimelinesTestAnimationFinishesDuringCommit); |
| 1000 | 1000 |
| 1001 // Check that SetTransformIsPotentiallyAnimatingChanged is called | 1001 // Check that SetTransformIsPotentiallyAnimatingChanged is called |
| 1002 // if we destroy LayerAnimationController and ElementAnimations. | 1002 // if we destroy LayerAnimationController and ElementAnimations. |
| 1003 class DISABLED_LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction | 1003 class LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction |
| 1004 : public LayerTreeHostTimelinesTest { | 1004 : public LayerTreeHostTimelinesTest { |
| 1005 public: | 1005 public: |
| 1006 void SetupTree() override { | 1006 void SetupTree() override { |
| 1007 LayerTreeHostTimelinesTest::SetupTree(); | 1007 LayerTreeHostTimelinesTest::SetupTree(); |
| 1008 AttachPlayersToTimeline(); | 1008 AttachPlayersToTimeline(); |
| 1009 player_->AttachLayer(layer_tree_host()->root_layer()->id()); | 1009 player_->AttachLayer(layer_tree_host()->root_layer()->id()); |
| 1010 AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5); | 1010 AddAnimatedTransformToPlayer(player_.get(), 1.0, 5, 5); |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 void BeginTest() override { PostSetNeedsCommitToMainThread(); } | 1013 void BeginTest() override { PostSetNeedsCommitToMainThread(); } |
| 1014 | 1014 |
| 1015 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { | 1015 void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override { |
| 1016 if (host_impl->active_tree()->source_frame_number() == 2) { | 1016 if (host_impl->active_tree()->source_frame_number() == 1) { |
| 1017 EXPECT_TRUE(host_impl->active_tree()); | 1017 EXPECT_TRUE(host_impl->active_tree()); |
| 1018 EXPECT_TRUE(host_impl->active_tree()->root_layer()); | 1018 EXPECT_TRUE(host_impl->active_tree()->root_layer()); |
| 1019 EXPECT_TRUE(host_impl->pending_tree()); | 1019 EXPECT_TRUE(host_impl->pending_tree()); |
| 1020 EXPECT_TRUE(host_impl->pending_tree()->root_layer()); | 1020 EXPECT_TRUE(host_impl->pending_tree()->root_layer()); |
| 1021 | 1021 |
| 1022 EXPECT_EQ(2, host_impl->pending_tree()->source_frame_number()); |
| 1023 |
| 1022 EXPECT_TRUE(host_impl->active_tree() | 1024 EXPECT_TRUE(host_impl->active_tree() |
| 1023 ->root_layer() | 1025 ->root_layer() |
| 1024 ->screen_space_transform_is_animating()); | 1026 ->screen_space_transform_is_animating()); |
| 1025 EXPECT_FALSE(host_impl->pending_tree() | 1027 EXPECT_FALSE(host_impl->pending_tree() |
| 1026 ->root_layer() | 1028 ->root_layer() |
| 1027 ->screen_space_transform_is_animating()); | 1029 ->screen_space_transform_is_animating()); |
| 1030 } else if (host_impl->active_tree()->source_frame_number() == 2) { |
| 1031 EXPECT_FALSE(host_impl->active_tree() |
| 1032 ->root_layer() |
| 1033 ->screen_space_transform_is_animating()); |
| 1034 EXPECT_FALSE(host_impl->pending_tree() |
| 1035 ->root_layer() |
| 1036 ->screen_space_transform_is_animating()); |
| 1028 } | 1037 } |
| 1029 } | 1038 } |
| 1030 | 1039 |
| 1031 void WillCommit() override {} | |
| 1032 | |
| 1033 void DidCommit() override { PostSetNeedsCommitToMainThread(); } | 1040 void DidCommit() override { PostSetNeedsCommitToMainThread(); } |
| 1034 | 1041 |
| 1035 void UpdateLayerTreeHost() override { | 1042 void UpdateLayerTreeHost() override { |
| 1036 if (layer_tree_host()->source_frame_number() == 2) { | 1043 if (layer_tree_host()->source_frame_number() == 2) { |
| 1037 // Destroy player. | 1044 // Destroy player. |
| 1038 timeline_->DetachPlayer(player_.get()); | 1045 timeline_->DetachPlayer(player_.get()); |
| 1039 player_ = nullptr; | 1046 player_ = nullptr; |
| 1040 } | 1047 } |
| 1041 } | 1048 } |
| 1042 | 1049 |
| 1043 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { | 1050 void DrawLayersOnThread(LayerTreeHostImpl* host_impl) override { |
| 1044 if (host_impl->active_tree()->source_frame_number() >= 2) | 1051 if (host_impl->active_tree()->source_frame_number() >= 2) |
| 1045 EndTest(); | 1052 EndTest(); |
| 1046 } | 1053 } |
| 1047 | 1054 |
| 1048 void AfterTest() override {} | 1055 void AfterTest() override {} |
| 1049 }; | 1056 }; |
| 1050 | 1057 |
| 1051 MULTI_THREAD_TEST_F( | 1058 MULTI_THREAD_TEST_F( |
| 1052 DISABLED_LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction); | 1059 LayerTreeHostTimelinesTestSetPotentiallyAnimatingOnLacDestruction); |
| 1053 | 1060 |
| 1054 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit. | 1061 // Check that we invalidate property trees on AnimationPlayer::SetNeedsCommit. |
| 1055 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit | 1062 class LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit |
| 1056 : public LayerTreeHostTimelinesTest { | 1063 : public LayerTreeHostTimelinesTest { |
| 1057 public: | 1064 public: |
| 1058 void SetupTree() override { | 1065 void SetupTree() override { |
| 1059 LayerTreeHostTimelinesTest::SetupTree(); | 1066 LayerTreeHostTimelinesTest::SetupTree(); |
| 1060 layer_ = FakePictureLayer::Create(layer_settings(), &client_); | 1067 layer_ = FakePictureLayer::Create(layer_settings(), &client_); |
| 1061 layer_->SetBounds(gfx::Size(4, 4)); | 1068 layer_->SetBounds(gfx::Size(4, 4)); |
| 1062 layer_tree_host()->root_layer()->AddChild(layer_); | 1069 layer_tree_host()->root_layer()->AddChild(layer_); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 private: | 1101 private: |
| 1095 scoped_refptr<Layer> layer_; | 1102 scoped_refptr<Layer> layer_; |
| 1096 FakeContentLayerClient client_; | 1103 FakeContentLayerClient client_; |
| 1097 }; | 1104 }; |
| 1098 | 1105 |
| 1099 MULTI_THREAD_TEST_F( | 1106 MULTI_THREAD_TEST_F( |
| 1100 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); | 1107 LayerTreeHostTimelinesTestRebuildPropertyTreesOnAnimationSetNeedsCommit); |
| 1101 | 1108 |
| 1102 } // namespace | 1109 } // namespace |
| 1103 } // namespace cc | 1110 } // namespace cc |
| OLD | NEW |