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 "base/thread_task_runner_handle.h" | 7 #include "base/thread_task_runner_handle.h" |
8 #include "cc/debug/lap_timer.h" | 8 #include "cc/debug/lap_timer.h" |
9 #include "cc/resources/tiling_set_raster_queue_all.h" | 9 #include "cc/resources/tiling_set_raster_queue_all.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 int num_tiles, | 119 int num_tiles, |
120 const gfx::Size& viewport_size) { | 120 const gfx::Size& viewport_size) { |
121 host_impl_.SetViewportSize(viewport_size); | 121 host_impl_.SetViewportSize(viewport_size); |
122 bool update_lcd_text = false; | 122 bool update_lcd_text = false; |
123 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 123 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
124 | 124 |
125 timer_.Reset(); | 125 timer_.Reset(); |
126 do { | 126 do { |
127 int count = num_tiles; | 127 int count = num_tiles; |
128 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( | 128 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
129 pending_layer_->picture_layer_tiling_set(), false)); | 129 pending_layer_->picture_layer_tiling_set())); |
130 while (count--) { | 130 while (count--) { |
131 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; | 131 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; |
132 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; | 132 ASSERT_TRUE(queue->Top() != nullptr) << "count: " << count; |
133 queue->Pop(); | 133 queue->Pop(); |
134 } | 134 } |
135 timer_.NextLap(); | 135 timer_.NextLap(); |
136 } while (!timer_.HasTimeLimitExpired()); | 136 } while (!timer_.HasTimeLimitExpired()); |
137 | 137 |
138 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", | 138 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", |
139 "", test_name, timer_.LapsPerSecond(), "runs/s", | 139 "", test_name, timer_.LapsPerSecond(), "runs/s", |
140 true); | 140 true); |
141 } | 141 } |
142 | 142 |
143 void RunEvictionQueueConstructTest(const std::string& test_name, | 143 void RunEvictionQueueConstructTest(const std::string& test_name, |
144 const gfx::Rect& viewport) { | 144 const gfx::Rect& viewport) { |
145 host_impl_.SetViewportSize(viewport.size()); | 145 host_impl_.SetViewportSize(viewport.size()); |
146 pending_layer_->PushScrollOffsetFromMainThread( | 146 pending_layer_->PushScrollOffsetFromMainThread( |
147 gfx::ScrollOffset(viewport.x(), viewport.y())); | 147 gfx::ScrollOffset(viewport.x(), viewport.y())); |
148 bool update_lcd_text = false; | 148 bool update_lcd_text = false; |
149 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 149 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
150 | 150 |
151 timer_.Reset(); | 151 timer_.Reset(); |
152 do { | 152 do { |
153 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( | 153 scoped_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
154 pending_layer_->picture_layer_tiling_set(), false)); | 154 pending_layer_->picture_layer_tiling_set())); |
155 timer_.NextLap(); | 155 timer_.NextLap(); |
156 } while (!timer_.HasTimeLimitExpired()); | 156 } while (!timer_.HasTimeLimitExpired()); |
157 | 157 |
158 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 158 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
159 timer_.LapsPerSecond(), "runs/s", true); | 159 timer_.LapsPerSecond(), "runs/s", true); |
160 } | 160 } |
161 | 161 |
162 protected: | 162 protected: |
163 TestSharedBitmapManager shared_bitmap_manager_; | 163 TestSharedBitmapManager shared_bitmap_manager_; |
164 TestTaskGraphRunner task_graph_runner_; | 164 TestTaskGraphRunner task_graph_runner_; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 244 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
245 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 245 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
246 | 246 |
247 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 247 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
248 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 248 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
249 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 249 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
250 } | 250 } |
251 | 251 |
252 } // namespace | 252 } // namespace |
253 } // namespace cc | 253 } // namespace cc |
OLD | NEW |