OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/animation/animation_host.h" | 5 #include "cc/animation/animation_host.h" |
6 | 6 |
7 #include "base/threading/thread_task_runner_handle.h" | 7 #include "base/threading/thread_task_runner_handle.h" |
8 #include "cc/animation/animation_id_provider.h" | 8 #include "cc/animation/animation_id_provider.h" |
9 #include "cc/animation/animation_player.h" | 9 #include "cc/animation/animation_player.h" |
10 #include "cc/animation/animation_timeline.h" | 10 #include "cc/animation/animation_timeline.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 scoped_refptr<AnimationTimeline> timeline = | 55 scoped_refptr<AnimationTimeline> timeline = |
56 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); | 56 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); |
57 host()->AddAnimationTimeline(timeline); | 57 host()->AddAnimationTimeline(timeline); |
58 | 58 |
59 const int first_player_id = AnimationIdProvider::NextPlayerId(); | 59 const int first_player_id = AnimationIdProvider::NextPlayerId(); |
60 int last_player_id = first_player_id; | 60 int last_player_id = first_player_id; |
61 | 61 |
62 for (int i = 0; i < num_players; ++i) { | 62 for (int i = 0; i < num_players; ++i) { |
63 scoped_refptr<Layer> layer = Layer::Create(); | 63 scoped_refptr<Layer> layer = Layer::Create(); |
64 root_layer_->AddChild(layer); | 64 root_layer_->AddChild(layer); |
| 65 layer->SetElementId(LayerIdToElementIdForTesting(layer->id())); |
65 | 66 |
66 scoped_refptr<AnimationPlayer> player = | 67 scoped_refptr<AnimationPlayer> player = |
67 AnimationPlayer::Create(last_player_id); | 68 AnimationPlayer::Create(last_player_id); |
68 last_player_id = AnimationIdProvider::NextPlayerId(); | 69 last_player_id = AnimationIdProvider::NextPlayerId(); |
69 | 70 |
70 timeline->AttachPlayer(player); | 71 timeline->AttachPlayer(player); |
71 player->AttachElement(layer->id()); | 72 player->AttachElement(layer->element_id()); |
72 EXPECT_TRUE(player->element_animations()); | 73 EXPECT_TRUE(player->element_animations()); |
73 } | 74 } |
74 | 75 |
75 // Create impl players. | 76 // Create impl players. |
76 layer_tree_host_->CommitAndCreateLayerImplTree(); | 77 layer_tree_host_->CommitAndCreateLayerImplTree(); |
77 | 78 |
78 // Check impl instances created. | 79 // Check impl instances created. |
79 scoped_refptr<AnimationTimeline> timeline_impl = | 80 scoped_refptr<AnimationTimeline> timeline_impl = |
80 host_impl()->GetTimelineById(timeline->id()); | 81 host_impl()->GetTimelineById(timeline->id()); |
81 EXPECT_TRUE(timeline_impl); | 82 EXPECT_TRUE(timeline_impl); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 CreateTimelines(10); | 133 CreateTimelines(10); |
133 DoTest(); | 134 DoTest(); |
134 } | 135 } |
135 | 136 |
136 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) { | 137 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) { |
137 CreateTimelines(1000); | 138 CreateTimelines(1000); |
138 DoTest(); | 139 DoTest(); |
139 } | 140 } |
140 | 141 |
141 } // namespace cc | 142 } // namespace cc |
OLD | NEW |