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())); | |
66 | 65 |
67 scoped_refptr<AnimationPlayer> player = | 66 scoped_refptr<AnimationPlayer> player = |
68 AnimationPlayer::Create(last_player_id); | 67 AnimationPlayer::Create(last_player_id); |
69 last_player_id = AnimationIdProvider::NextPlayerId(); | 68 last_player_id = AnimationIdProvider::NextPlayerId(); |
70 | 69 |
71 timeline->AttachPlayer(player); | 70 timeline->AttachPlayer(player); |
72 player->AttachElement(layer->element_id()); | 71 player->AttachElement(layer->id()); |
73 EXPECT_TRUE(player->element_animations()); | 72 EXPECT_TRUE(player->element_animations()); |
74 } | 73 } |
75 | 74 |
76 // Create impl players. | 75 // Create impl players. |
77 layer_tree_host_->CommitAndCreateLayerImplTree(); | 76 layer_tree_host_->CommitAndCreateLayerImplTree(); |
78 | 77 |
79 // Check impl instances created. | 78 // Check impl instances created. |
80 scoped_refptr<AnimationTimeline> timeline_impl = | 79 scoped_refptr<AnimationTimeline> timeline_impl = |
81 host_impl()->GetTimelineById(timeline->id()); | 80 host_impl()->GetTimelineById(timeline->id()); |
82 EXPECT_TRUE(timeline_impl); | 81 EXPECT_TRUE(timeline_impl); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 CreateTimelines(10); | 132 CreateTimelines(10); |
134 DoTest(); | 133 DoTest(); |
135 } | 134 } |
136 | 135 |
137 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) { | 136 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) { |
138 CreateTimelines(1000); | 137 CreateTimelines(1000); |
139 DoTest(); | 138 DoTest(); |
140 } | 139 } |
141 | 140 |
142 } // namespace cc | 141 } // namespace cc |
OLD | NEW |