| 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/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "cc/base/lap_timer.h" | 9 #include "cc/base/lap_timer.h" |
| 10 #include "cc/test/fake_compositor_frame_sink.h" | 10 #include "cc/test/fake_compositor_frame_sink.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 int num_tiles, | 127 int num_tiles, |
| 128 const gfx::Size& viewport_size) { | 128 const gfx::Size& viewport_size) { |
| 129 host_impl_.SetViewportSize(viewport_size); | 129 host_impl_.SetViewportSize(viewport_size); |
| 130 bool update_lcd_text = false; | 130 bool update_lcd_text = false; |
| 131 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 131 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 132 | 132 |
| 133 timer_.Reset(); | 133 timer_.Reset(); |
| 134 do { | 134 do { |
| 135 int count = num_tiles; | 135 int count = num_tiles; |
| 136 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( | 136 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
| 137 pending_layer_->picture_layer_tiling_set())); | 137 pending_layer_->picture_layer_tiling_set(), |
| 138 pending_layer_->contributes_to_drawn_render_surface())); |
| 138 while (count--) { | 139 while (count--) { |
| 139 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; | 140 ASSERT_TRUE(!queue->IsEmpty()) << "count: " << count; |
| 140 ASSERT_TRUE(queue->Top().tile()) << "count: " << count; | 141 ASSERT_TRUE(queue->Top().tile()) << "count: " << count; |
| 141 queue->Pop(); | 142 queue->Pop(); |
| 142 } | 143 } |
| 143 timer_.NextLap(); | 144 timer_.NextLap(); |
| 144 } while (!timer_.HasTimeLimitExpired()); | 145 } while (!timer_.HasTimeLimitExpired()); |
| 145 | 146 |
| 146 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", | 147 perf_test::PrintResult("tiling_set_eviction_queue_construct_and_iterate", |
| 147 "", test_name, timer_.LapsPerSecond(), "runs/s", | 148 "", test_name, timer_.LapsPerSecond(), "runs/s", |
| 148 true); | 149 true); |
| 149 } | 150 } |
| 150 | 151 |
| 151 void RunEvictionQueueConstructTest(const std::string& test_name, | 152 void RunEvictionQueueConstructTest(const std::string& test_name, |
| 152 const gfx::Rect& viewport) { | 153 const gfx::Rect& viewport) { |
| 153 host_impl_.SetViewportSize(viewport.size()); | 154 host_impl_.SetViewportSize(viewport.size()); |
| 154 host_impl_.pending_tree() | 155 host_impl_.pending_tree() |
| 155 ->property_trees() | 156 ->property_trees() |
| 156 ->scroll_tree.UpdateScrollOffsetBaseForTesting( | 157 ->scroll_tree.UpdateScrollOffsetBaseForTesting( |
| 157 pending_layer_->id(), | 158 pending_layer_->id(), |
| 158 gfx::ScrollOffset(viewport.x(), viewport.y())); | 159 gfx::ScrollOffset(viewport.x(), viewport.y())); |
| 159 bool update_lcd_text = false; | 160 bool update_lcd_text = false; |
| 160 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 161 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 161 | 162 |
| 162 timer_.Reset(); | 163 timer_.Reset(); |
| 163 do { | 164 do { |
| 164 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( | 165 std::unique_ptr<TilingSetEvictionQueue> queue(new TilingSetEvictionQueue( |
| 165 pending_layer_->picture_layer_tiling_set())); | 166 pending_layer_->picture_layer_tiling_set(), |
| 167 pending_layer_->contributes_to_drawn_render_surface())); |
| 166 timer_.NextLap(); | 168 timer_.NextLap(); |
| 167 } while (!timer_.HasTimeLimitExpired()); | 169 } while (!timer_.HasTimeLimitExpired()); |
| 168 | 170 |
| 169 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, | 171 perf_test::PrintResult("tiling_set_eviction_queue_construct", "", test_name, |
| 170 timer_.LapsPerSecond(), "runs/s", true); | 172 timer_.LapsPerSecond(), "runs/s", true); |
| 171 } | 173 } |
| 172 | 174 |
| 173 protected: | 175 protected: |
| 174 TestTaskGraphRunner task_graph_runner_; | 176 TestTaskGraphRunner task_graph_runner_; |
| 175 FakeImplTaskRunnerProvider task_runner_provider_; | 177 FakeImplTaskRunnerProvider task_runner_provider_; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); | 259 ASSERT_TRUE(host_impl_.tile_manager() != nullptr); |
| 258 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); | 260 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(all_tiles); |
| 259 | 261 |
| 260 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); | 262 RunEvictionQueueConstructTest("0_0_100x100", gfx::Rect(0, 0, 100, 100)); |
| 261 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); | 263 RunEvictionQueueConstructTest("5000_0_100x100", gfx::Rect(5000, 0, 100, 100)); |
| 262 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); | 264 RunEvictionQueueConstructTest("9999_0_100x100", gfx::Rect(9999, 0, 100, 100)); |
| 263 } | 265 } |
| 264 | 266 |
| 265 } // namespace | 267 } // namespace |
| 266 } // namespace cc | 268 } // namespace cc |
| OLD | NEW |