Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: cc/animation/animation_host_perftest.cc

Issue 2710593003: cc: Fix const value pattern by replacing it by non-const or reference. (Closed)
Patch Set: update rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cc/debug/rasterize_and_record_benchmark_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 layer_tree_host_->SetRootLayer(nullptr); 50 layer_tree_host_->SetRootLayer(nullptr);
51 layer_tree_host_ = nullptr; 51 layer_tree_host_ = nullptr;
52 } 52 }
53 53
54 AnimationHost* host() const { return animation_host_.get(); } 54 AnimationHost* host() const { return animation_host_.get(); }
55 AnimationHost* host_impl() const { 55 AnimationHost* host_impl() const {
56 return layer_tree_host_->host_impl()->animation_host(); 56 return layer_tree_host_->host_impl()->animation_host();
57 } 57 }
58 58
59 void CreatePlayers(const int num_players) { 59 void CreatePlayers(int num_players) {
60 all_players_timeline_ = 60 all_players_timeline_ =
61 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId()); 61 AnimationTimeline::Create(AnimationIdProvider::NextTimelineId());
62 host()->AddAnimationTimeline(all_players_timeline_); 62 host()->AddAnimationTimeline(all_players_timeline_);
63 63
64 first_player_id_ = AnimationIdProvider::NextPlayerId(); 64 first_player_id_ = AnimationIdProvider::NextPlayerId();
65 last_player_id_ = first_player_id_; 65 last_player_id_ = first_player_id_;
66 66
67 for (int i = 0; i < num_players; ++i) { 67 for (int i = 0; i < num_players; ++i) {
68 scoped_refptr<Layer> layer = Layer::Create(); 68 scoped_refptr<Layer> layer = Layer::Create();
69 root_layer_->AddChild(layer); 69 root_layer_->AddChild(layer);
(...skipping 12 matching lines...) Expand all
82 layer_tree_host_->CommitAndCreateLayerImplTree(); 82 layer_tree_host_->CommitAndCreateLayerImplTree();
83 83
84 // Check impl instances created. 84 // Check impl instances created.
85 scoped_refptr<AnimationTimeline> timeline_impl = 85 scoped_refptr<AnimationTimeline> timeline_impl =
86 host_impl()->GetTimelineById(all_players_timeline_->id()); 86 host_impl()->GetTimelineById(all_players_timeline_->id());
87 EXPECT_TRUE(timeline_impl); 87 EXPECT_TRUE(timeline_impl);
88 for (int i = first_player_id_; i < last_player_id_; ++i) 88 for (int i = first_player_id_; i < last_player_id_; ++i)
89 EXPECT_TRUE(timeline_impl->GetPlayerById(i)); 89 EXPECT_TRUE(timeline_impl->GetPlayerById(i));
90 } 90 }
91 91
92 void CreateTimelines(const int num_timelines) { 92 void CreateTimelines(int num_timelines) {
93 first_timeline_id_ = AnimationIdProvider::NextTimelineId(); 93 first_timeline_id_ = AnimationIdProvider::NextTimelineId();
94 last_timeline_id_ = first_timeline_id_; 94 last_timeline_id_ = first_timeline_id_;
95 95
96 for (int i = 0; i < num_timelines; ++i) { 96 for (int i = 0; i < num_timelines; ++i) {
97 scoped_refptr<AnimationTimeline> timeline = 97 scoped_refptr<AnimationTimeline> timeline =
98 AnimationTimeline::Create(last_timeline_id_); 98 AnimationTimeline::Create(last_timeline_id_);
99 last_timeline_id_ = AnimationIdProvider::NextTimelineId(); 99 last_timeline_id_ = AnimationIdProvider::NextTimelineId();
100 host()->AddAnimationTimeline(timeline); 100 host()->AddAnimationTimeline(timeline);
101 } 101 }
102 102
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 CreateTimelines(10); 160 CreateTimelines(10);
161 DoTest(); 161 DoTest();
162 } 162 }
163 163
164 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) { 164 TEST_F(AnimationHostPerfTest, Push1000TimelinesPropertiesTo) {
165 CreateTimelines(1000); 165 CreateTimelines(1000);
166 DoTest(); 166 DoTest();
167 } 167 }
168 168
169 } // namespace cc 169 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/debug/rasterize_and_record_benchmark_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698