OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include "cc/debug/lap_timer.h" | 7 #include "cc/debug/lap_timer.h" |
8 #include "cc/resources/tiling_set_raster_queue_all.h" | 8 #include "cc/resources/tiling_set_raster_queue_all.h" |
9 #include "cc/test/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 | 115 |
116 void RunEvictionQueueConstructAndIterateTest( | 116 void RunEvictionQueueConstructAndIterateTest( |
117 const std::string& test_name, | 117 const std::string& test_name, |
118 int num_tiles, | 118 int num_tiles, |
119 const gfx::Size& viewport_size) { | 119 const gfx::Size& viewport_size) { |
120 host_impl_.SetViewportSize(viewport_size); | 120 host_impl_.SetViewportSize(viewport_size); |
121 bool update_lcd_text = false; | 121 bool update_lcd_text = false; |
122 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 122 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
123 | 123 |
124 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
125 SMOOTHNESS_TAKES_PRIORITY, | |
126 NEW_CONTENT_TAKES_PRIORITY}; | |
127 int priority_count = 0; | |
128 timer_.Reset(); | 124 timer_.Reset(); |
129 do { | 125 do { |
130 int count = num_tiles; | 126 int count = num_tiles; |
131 scoped_ptr<TilingSetEvictionQueue> queue( | 127 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
132 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(), | 128 pending_layer_->picture_layer_tiling_set(), false)); |
133 priorities[priority_count], false)); | |
134 while (count--) { | 129 while (count--) { |
135 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; | 130 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; |
136 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; | 131 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; |
137 queue->Pop(); | 132 queue->Pop(); |
138 } | 133 } |
139 priority_count = (priority_count + 1) % arraysize(priorities); | |
140 timer_.NextLap(); | 134 timer_.NextLap(); |
141 } while (!timer_.HasTimeLimitExpired()); | 135 } while (!timer_.HasTimeLimitExpired()); |
142 | 136 |
143 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", | 137 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", |
144 "", test_name, timer_.LapsPerSecond(), "runs/s", | 138 "", test_name, timer_.LapsPerSecond(), "runs/s", |
145 true); | 139 true); |
146 } | 140 } |
147 | 141 |
148 void RunEvictionQueueConstructTest(const std::string& test_name, | 142 void RunEvictionQueueConstructTest(const std::string& test_name, |
149 const gfx::Rect& viewport) { | 143 const gfx::Rect& viewport) { |
150 host_impl_.SetViewportSize(viewport.size()); | 144 host_impl_.SetViewportSize(viewport.size()); |
151 pending_layer_->PushScrollOffsetFromMainThread( | 145 pending_layer_->PushScrollOffsetFromMainThread( |
152 gfx::ScrollOffset(viewport.x(), viewport.y())); | 146 gfx::ScrollOffset(viewport.x(), viewport.y())); |
153 bool update_lcd_text = false; | 147 bool update_lcd_text = false; |
154 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 148 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
155 | 149 |
156 TreePriority priorities[] = {SAME_PRIORITY_FOR_BOTH_TREES, | |
157 SMOOTHNESS_TAKES_PRIORITY, | |
158 NEW_CONTENT_TAKES_PRIORITY}; | |
159 int priority_count = 0; | |
160 timer_.Reset(); | 150 timer_.Reset(); |
161 do { | 151 do { |
162 scoped_ptr<TilingSetEvictionQueue> queue( | 152 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
163 new TilingSetEvictionQueue(pending_layer_->picture_layer_tiling_set(), | 153 pending_layer_->picture_layer_tiling_set(), false)); |
164 priorities[priority_count], false)); | |
165 priority_count = (priority_count + 1) % arraysize(priorities); | |
166 timer_.NextLap(); | 154 timer_.NextLap(); |
167 } while (!timer_.HasTimeLimitExpired()); | 155 } while (!timer_.HasTimeLimitExpired()); |
168 | 156 |
169 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 157 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
170 timer_.LapsPerSecond(), "runs/s", true); | 158 timer_.LapsPerSecond(), "runs/s", true); |
171 } | 159 } |
172 | 160 |
173 protected: | 161 protected: |
174 TestSharedBitmapManager shared_bitmap_manager_; | 162 TestSharedBitmapManager shared_bitmap_manager_; |
175 TestTaskGraphRunner task_graph_runner_; | 163 TestTaskGraphRunner task_graph_runner_; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 243 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
256 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 244 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
257 | 245 |
258 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 246 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
259 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 247 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
260 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 248 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
261 } | 249 } |
262 | 250 |
263 } // namespace | 251 } // namespace |
264 } // namespace cc | 252 } // namespace cc |
OLD | NEW |