| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| 11 #include "cc/playback/raster_source.h" | 11 #include "cc/playback/raster_source.h" |
| 12 #include "cc/playback/recording_source.h" | 12 #include "cc/playback/recording_source.h" |
| 13 #include "cc/raster/raster_buffer.h" | 13 #include "cc/raster/raster_buffer.h" |
| 14 #include "cc/raster/synchronous_task_graph_runner.h" | 14 #include "cc/raster/synchronous_task_graph_runner.h" |
| 15 #include "cc/resources/resource_pool.h" | 15 #include "cc/resources/resource_pool.h" |
| 16 #include "cc/test/begin_frame_args_test.h" | 16 #include "cc/test/begin_frame_args_test.h" |
| 17 #include "cc/test/fake_impl_task_runner_provider.h" | 17 #include "cc/test/fake_impl_task_runner_provider.h" |
| 18 #include "cc/test/fake_layer_tree_host_impl.h" | 18 #include "cc/test/fake_layer_tree_host_impl.h" |
| 19 #include "cc/test/fake_output_surface.h" | 19 #include "cc/test/fake_output_surface.h" |
| 20 #include "cc/test/fake_output_surface_client.h" | 20 #include "cc/test/fake_output_surface_client.h" |
| 21 #include "cc/test/fake_picture_layer_impl.h" | 21 #include "cc/test/fake_picture_layer_impl.h" |
| 22 #include "cc/test/fake_picture_layer_tiling_client.h" | 22 #include "cc/test/fake_picture_layer_tiling_client.h" |
| 23 #include "cc/test/fake_raster_source.h" | 23 #include "cc/test/fake_raster_source.h" |
| 24 #include "cc/test/fake_recording_source.h" | 24 #include "cc/test/fake_recording_source.h" |
| 25 #include "cc/test/fake_tile_manager.h" | 25 #include "cc/test/fake_tile_manager.h" |
| 26 #include "cc/test/fake_tile_task_manager.h" | 26 #include "cc/test/fake_tile_task_manager.h" |
| 27 #include "cc/test/test_gpu_memory_buffer_manager.h" | 27 #include "cc/test/test_gpu_memory_buffer_manager.h" |
| 28 #include "cc/test/test_layer_tree_host_base.h" |
| 28 #include "cc/test/test_shared_bitmap_manager.h" | 29 #include "cc/test/test_shared_bitmap_manager.h" |
| 29 #include "cc/test/test_task_graph_runner.h" | 30 #include "cc/test/test_task_graph_runner.h" |
| 30 #include "cc/test/test_tile_priorities.h" | 31 #include "cc/test/test_tile_priorities.h" |
| 31 #include "cc/tiles/eviction_tile_priority_queue.h" | 32 #include "cc/tiles/eviction_tile_priority_queue.h" |
| 32 #include "cc/tiles/raster_tile_priority_queue.h" | 33 #include "cc/tiles/raster_tile_priority_queue.h" |
| 33 #include "cc/tiles/tile.h" | 34 #include "cc/tiles/tile.h" |
| 34 #include "cc/tiles/tile_priority.h" | 35 #include "cc/tiles/tile_priority.h" |
| 35 #include "cc/tiles/tiling_set_raster_queue_all.h" | 36 #include "cc/tiles/tiling_set_raster_queue_all.h" |
| 36 #include "cc/trees/layer_tree_impl.h" | 37 #include "cc/trees/layer_tree_impl.h" |
| 37 #include "testing/gmock/include/gmock/gmock.h" | 38 #include "testing/gmock/include/gmock/gmock.h" |
| 38 #include "testing/gtest/include/gtest/gtest.h" | 39 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "third_party/skia/include/core/SkRefCnt.h" | 40 #include "third_party/skia/include/core/SkRefCnt.h" |
| 40 #include "third_party/skia/include/core/SkSurface.h" | 41 #include "third_party/skia/include/core/SkSurface.h" |
| 41 | 42 |
| 42 namespace cc { | 43 namespace cc { |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 class LowResTilingsSettings : public LayerTreeSettings { | 46 class TileManagerTilePriorityQueueTest : public TestLayerTreeHostBase { |
| 46 public: | 47 public: |
| 47 LowResTilingsSettings() { | 48 LayerTreeSettings CreateSettings() override { |
| 48 create_low_res_tiling = true; | 49 LayerTreeSettings settings; |
| 49 verify_clip_tree_calculations = true; | 50 settings.create_low_res_tiling = true; |
| 50 } | 51 settings.verify_clip_tree_calculations = true; |
| 51 }; | 52 return settings; |
| 52 | |
| 53 class TileManagerTilePriorityQueueTest : public testing::Test { | |
| 54 public: | |
| 55 TileManagerTilePriorityQueueTest() | |
| 56 : memory_limit_policy_(ALLOW_ANYTHING), | |
| 57 max_tiles_(10000), | |
| 58 ready_to_activate_(false), | |
| 59 id_(7), | |
| 60 task_runner_provider_(base::ThreadTaskRunnerHandle::Get()), | |
| 61 output_surface_(FakeOutputSurface::Create3d()), | |
| 62 host_impl_(LowResTilingsSettings(), | |
| 63 &task_runner_provider_, | |
| 64 &shared_bitmap_manager_, | |
| 65 &task_graph_runner_, | |
| 66 &gpu_memory_buffer_manager_) {} | |
| 67 | |
| 68 void SetTreePriority(TreePriority tree_priority) { | |
| 69 GlobalStateThatImpactsTilePriority state; | |
| 70 gfx::Size tile_size(256, 256); | |
| 71 | |
| 72 state.soft_memory_limit_in_bytes = 100 * 1000 * 1000; | |
| 73 state.num_resources_limit = max_tiles_; | |
| 74 state.hard_memory_limit_in_bytes = state.soft_memory_limit_in_bytes * 2; | |
| 75 state.memory_limit_policy = memory_limit_policy_; | |
| 76 state.tree_priority = tree_priority; | |
| 77 | |
| 78 global_state_ = state; | |
| 79 host_impl_.resource_pool()->SetResourceUsageLimits( | |
| 80 state.soft_memory_limit_in_bytes, | |
| 81 state.num_resources_limit); | |
| 82 host_impl_.tile_manager()->SetGlobalStateForTesting(state); | |
| 83 } | 53 } |
| 84 | 54 |
| 85 void SetUp() override { | 55 TileManager* tile_manager() { return host_impl()->tile_manager(); } |
| 86 InitializeRenderer(); | |
| 87 SetTreePriority(SAME_PRIORITY_FOR_BOTH_TREES); | |
| 88 } | |
| 89 | |
| 90 virtual void InitializeRenderer() { | |
| 91 host_impl_.SetVisible(true); | |
| 92 host_impl_.InitializeRenderer(output_surface_.get()); | |
| 93 } | |
| 94 | |
| 95 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | |
| 96 scoped_refptr<FakeRasterSource> pending_raster_source = | |
| 97 FakeRasterSource::CreateFilled(layer_bounds); | |
| 98 scoped_refptr<FakeRasterSource> active_raster_source = | |
| 99 FakeRasterSource::CreateFilled(layer_bounds); | |
| 100 | |
| 101 SetupTrees(pending_raster_source, active_raster_source); | |
| 102 } | |
| 103 | |
| 104 // This matches picture_layer_impl_unittest's ActivateTree. | |
| 105 void ActivateTree() { | |
| 106 host_impl_.ActivateSyncTree(); | |
| 107 CHECK(!host_impl_.pending_tree()); | |
| 108 pending_layer_ = NULL; | |
| 109 active_layer_ = static_cast<FakePictureLayerImpl*>( | |
| 110 host_impl_.active_tree()->LayerById(id_)); | |
| 111 bool update_lcd_text = false; | |
| 112 host_impl_.active_tree()->UpdateDrawProperties(update_lcd_text); | |
| 113 } | |
| 114 | |
| 115 void SetupDefaultTreesWithFixedTileSize(const gfx::Size& layer_bounds, | |
| 116 const gfx::Size& tile_size) { | |
| 117 SetupDefaultTrees(layer_bounds); | |
| 118 pending_layer_->set_fixed_tile_size(tile_size); | |
| 119 active_layer_->set_fixed_tile_size(tile_size); | |
| 120 } | |
| 121 | |
| 122 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, | |
| 123 scoped_refptr<RasterSource> active_raster_source) { | |
| 124 SetupPendingTree(active_raster_source); | |
| 125 ActivateTree(); | |
| 126 SetupPendingTree(pending_raster_source); | |
| 127 } | |
| 128 | |
| 129 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) { | |
| 130 host_impl_.CreatePendingTree(); | |
| 131 LayerTreeImpl* pending_tree = host_impl_.pending_tree(); | |
| 132 | |
| 133 // Steal from the recycled tree. | |
| 134 LayerImpl* old_pending_root = pending_tree->root_layer(); | |
| 135 DCHECK(!old_pending_root || old_pending_root->id() == id_); | |
| 136 | |
| 137 FakePictureLayerImpl* pending_layer = nullptr; | |
| 138 if (old_pending_root) { | |
| 139 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); | |
| 140 pending_layer->SetRasterSourceOnPending(raster_source, Region()); | |
| 141 } else { | |
| 142 std::unique_ptr<FakePictureLayerImpl> new_root = | |
| 143 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, | |
| 144 raster_source); | |
| 145 pending_layer = new_root.get(); | |
| 146 pending_tree->SetRootLayer(std::move(new_root)); | |
| 147 pending_layer->SetDrawsContent(true); | |
| 148 pending_layer->SetHasRenderSurface(true); | |
| 149 } | |
| 150 // The bounds() just mirror the raster source size. | |
| 151 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | |
| 152 | |
| 153 pending_layer_ = static_cast<FakePictureLayerImpl*>( | |
| 154 host_impl_.pending_tree()->LayerById(id_)); | |
| 155 | |
| 156 // Add tilings/tiles for the layer. | |
| 157 bool update_lcd_text = false; | |
| 158 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | |
| 159 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | |
| 160 } | |
| 161 | |
| 162 TileManager* tile_manager() { return host_impl_.tile_manager(); } | |
| 163 | |
| 164 protected: | |
| 165 GlobalStateThatImpactsTilePriority global_state_; | |
| 166 | |
| 167 TestSharedBitmapManager shared_bitmap_manager_; | |
| 168 TestTaskGraphRunner task_graph_runner_; | |
| 169 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | |
| 170 TileMemoryLimitPolicy memory_limit_policy_; | |
| 171 int max_tiles_; | |
| 172 bool ready_to_activate_; | |
| 173 int id_; | |
| 174 FakeImplTaskRunnerProvider task_runner_provider_; | |
| 175 std::unique_ptr<OutputSurface> output_surface_; | |
| 176 FakeLayerTreeHostImpl host_impl_; | |
| 177 FakePictureLayerImpl* pending_layer_; | |
| 178 FakePictureLayerImpl* active_layer_; | |
| 179 }; | 56 }; |
| 180 | 57 |
| 181 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { | 58 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { |
| 182 const gfx::Size layer_bounds(1000, 1000); | 59 const gfx::Size layer_bounds(1000, 1000); |
| 183 host_impl_.SetViewportSize(layer_bounds); | 60 host_impl()->SetViewportSize(layer_bounds); |
| 184 SetupDefaultTrees(layer_bounds); | 61 SetupDefaultTrees(layer_bounds); |
| 185 | 62 |
| 186 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 63 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 187 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 64 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 188 EXPECT_FALSE(queue->IsEmpty()); | 65 EXPECT_FALSE(queue->IsEmpty()); |
| 189 | 66 |
| 190 size_t tile_count = 0; | 67 size_t tile_count = 0; |
| 191 std::set<Tile*> all_tiles; | 68 std::set<Tile*> all_tiles; |
| 192 while (!queue->IsEmpty()) { | 69 while (!queue->IsEmpty()) { |
| 193 EXPECT_TRUE(queue->Top().tile()); | 70 EXPECT_TRUE(queue->Top().tile()); |
| 194 all_tiles.insert(queue->Top().tile()); | 71 all_tiles.insert(queue->Top().tile()); |
| 195 ++tile_count; | 72 ++tile_count; |
| 196 queue->Pop(); | 73 queue->Pop(); |
| 197 } | 74 } |
| 198 | 75 |
| 199 EXPECT_EQ(tile_count, all_tiles.size()); | 76 EXPECT_EQ(tile_count, all_tiles.size()); |
| 200 EXPECT_EQ(16u, tile_count); | 77 EXPECT_EQ(16u, tile_count); |
| 201 | 78 |
| 202 // Sanity check, all tiles should be visible. | 79 // Sanity check, all tiles should be visible. |
| 203 std::set<Tile*> smoothness_tiles; | 80 std::set<Tile*> smoothness_tiles; |
| 204 queue = host_impl_.BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, | 81 queue = host_impl()->BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, |
| 205 RasterTilePriorityQueue::Type::ALL); | 82 RasterTilePriorityQueue::Type::ALL); |
| 206 bool had_low_res = false; | 83 bool had_low_res = false; |
| 207 while (!queue->IsEmpty()) { | 84 while (!queue->IsEmpty()) { |
| 208 PrioritizedTile prioritized_tile = queue->Top(); | 85 PrioritizedTile prioritized_tile = queue->Top(); |
| 209 EXPECT_TRUE(prioritized_tile.tile()); | 86 EXPECT_TRUE(prioritized_tile.tile()); |
| 210 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); | 87 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); |
| 211 if (prioritized_tile.priority().resolution == LOW_RESOLUTION) | 88 if (prioritized_tile.priority().resolution == LOW_RESOLUTION) |
| 212 had_low_res = true; | 89 had_low_res = true; |
| 213 else | 90 else |
| 214 smoothness_tiles.insert(prioritized_tile.tile()); | 91 smoothness_tiles.insert(prioritized_tile.tile()); |
| 215 queue->Pop(); | 92 queue->Pop(); |
| 216 } | 93 } |
| 217 EXPECT_EQ(all_tiles, smoothness_tiles); | 94 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 218 EXPECT_TRUE(had_low_res); | 95 EXPECT_TRUE(had_low_res); |
| 219 | 96 |
| 220 // Check that everything is required for activation. | 97 // Check that everything is required for activation. |
| 221 queue = host_impl_.BuildRasterQueue( | 98 queue = host_impl()->BuildRasterQueue( |
| 222 SMOOTHNESS_TAKES_PRIORITY, | 99 SMOOTHNESS_TAKES_PRIORITY, |
| 223 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); | 100 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 224 std::set<Tile*> required_for_activation_tiles; | 101 std::set<Tile*> required_for_activation_tiles; |
| 225 while (!queue->IsEmpty()) { | 102 while (!queue->IsEmpty()) { |
| 226 PrioritizedTile prioritized_tile = queue->Top(); | 103 PrioritizedTile prioritized_tile = queue->Top(); |
| 227 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); | 104 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); |
| 228 required_for_activation_tiles.insert(prioritized_tile.tile()); | 105 required_for_activation_tiles.insert(prioritized_tile.tile()); |
| 229 queue->Pop(); | 106 queue->Pop(); |
| 230 } | 107 } |
| 231 EXPECT_EQ(all_tiles, required_for_activation_tiles); | 108 EXPECT_EQ(all_tiles, required_for_activation_tiles); |
| 232 | 109 |
| 233 // Check that everything is required for draw. | 110 // Check that everything is required for draw. |
| 234 queue = host_impl_.BuildRasterQueue( | 111 queue = host_impl()->BuildRasterQueue( |
| 235 SMOOTHNESS_TAKES_PRIORITY, | 112 SMOOTHNESS_TAKES_PRIORITY, |
| 236 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 113 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 237 std::set<Tile*> required_for_draw_tiles; | 114 std::set<Tile*> required_for_draw_tiles; |
| 238 while (!queue->IsEmpty()) { | 115 while (!queue->IsEmpty()) { |
| 239 PrioritizedTile prioritized_tile = queue->Top(); | 116 PrioritizedTile prioritized_tile = queue->Top(); |
| 240 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); | 117 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); |
| 241 required_for_draw_tiles.insert(prioritized_tile.tile()); | 118 required_for_draw_tiles.insert(prioritized_tile.tile()); |
| 242 queue->Pop(); | 119 queue->Pop(); |
| 243 } | 120 } |
| 244 EXPECT_EQ(all_tiles, required_for_draw_tiles); | 121 EXPECT_EQ(all_tiles, required_for_draw_tiles); |
| 245 | 122 |
| 246 Region invalidation(gfx::Rect(0, 0, 500, 500)); | 123 Region invalidation(gfx::Rect(0, 0, 500, 500)); |
| 247 | 124 |
| 248 // Invalidate the pending tree. | 125 // Invalidate the pending tree. |
| 249 pending_layer_->set_invalidation(invalidation); | 126 pending_layer()->set_invalidation(invalidation); |
| 250 pending_layer_->HighResTiling()->Invalidate(invalidation); | 127 pending_layer()->HighResTiling()->Invalidate(invalidation); |
| 251 | 128 |
| 252 // Renew all of the tile priorities. | 129 // Renew all of the tile priorities. |
| 253 gfx::Rect viewport(50, 50, 100, 100); | 130 gfx::Rect viewport(50, 50, 100, 100); |
| 254 pending_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 131 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 255 viewport, 1.0f, 1.0, Occlusion(), true); | 132 viewport, 1.0f, 1.0, Occlusion(), true); |
| 256 active_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 133 active_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 257 viewport, 1.0f, 1.0, Occlusion(), true); | 134 viewport, 1.0f, 1.0, Occlusion(), true); |
| 258 | 135 |
| 259 // Populate all tiles directly from the tilings. | 136 // Populate all tiles directly from the tilings. |
| 260 all_tiles.clear(); | 137 all_tiles.clear(); |
| 261 std::set<Tile*> high_res_tiles; | 138 std::set<Tile*> high_res_tiles; |
| 262 std::vector<Tile*> pending_high_res_tiles = | 139 std::vector<Tile*> pending_high_res_tiles = |
| 263 pending_layer_->HighResTiling()->AllTilesForTesting(); | 140 pending_layer()->HighResTiling()->AllTilesForTesting(); |
| 264 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) { | 141 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) { |
| 265 all_tiles.insert(pending_high_res_tiles[i]); | 142 all_tiles.insert(pending_high_res_tiles[i]); |
| 266 high_res_tiles.insert(pending_high_res_tiles[i]); | 143 high_res_tiles.insert(pending_high_res_tiles[i]); |
| 267 } | 144 } |
| 268 | 145 |
| 269 std::vector<Tile*> active_high_res_tiles = | 146 std::vector<Tile*> active_high_res_tiles = |
| 270 active_layer_->HighResTiling()->AllTilesForTesting(); | 147 active_layer()->HighResTiling()->AllTilesForTesting(); |
| 271 for (size_t i = 0; i < active_high_res_tiles.size(); ++i) { | 148 for (size_t i = 0; i < active_high_res_tiles.size(); ++i) { |
| 272 all_tiles.insert(active_high_res_tiles[i]); | 149 all_tiles.insert(active_high_res_tiles[i]); |
| 273 high_res_tiles.insert(active_high_res_tiles[i]); | 150 high_res_tiles.insert(active_high_res_tiles[i]); |
| 274 } | 151 } |
| 275 | 152 |
| 276 std::vector<Tile*> active_low_res_tiles = | 153 std::vector<Tile*> active_low_res_tiles = |
| 277 active_layer_->LowResTiling()->AllTilesForTesting(); | 154 active_layer()->LowResTiling()->AllTilesForTesting(); |
| 278 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) | 155 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) |
| 279 all_tiles.insert(active_low_res_tiles[i]); | 156 all_tiles.insert(active_low_res_tiles[i]); |
| 280 | 157 |
| 281 PrioritizedTile last_tile; | 158 PrioritizedTile last_tile; |
| 282 smoothness_tiles.clear(); | 159 smoothness_tiles.clear(); |
| 283 tile_count = 0; | 160 tile_count = 0; |
| 284 size_t correct_order_tiles = 0u; | 161 size_t correct_order_tiles = 0u; |
| 285 // Here we expect to get increasing ACTIVE_TREE priority_bin. | 162 // Here we expect to get increasing ACTIVE_TREE priority_bin. |
| 286 queue = host_impl_.BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, | 163 queue = host_impl()->BuildRasterQueue(SMOOTHNESS_TAKES_PRIORITY, |
| 287 RasterTilePriorityQueue::Type::ALL); | 164 RasterTilePriorityQueue::Type::ALL); |
| 288 std::set<Tile*> expected_required_for_draw_tiles; | 165 std::set<Tile*> expected_required_for_draw_tiles; |
| 289 std::set<Tile*> expected_required_for_activation_tiles; | 166 std::set<Tile*> expected_required_for_activation_tiles; |
| 290 while (!queue->IsEmpty()) { | 167 while (!queue->IsEmpty()) { |
| 291 PrioritizedTile prioritized_tile = queue->Top(); | 168 PrioritizedTile prioritized_tile = queue->Top(); |
| 292 EXPECT_TRUE(prioritized_tile.tile()); | 169 EXPECT_TRUE(prioritized_tile.tile()); |
| 293 | 170 |
| 294 if (!last_tile.tile()) | 171 if (!last_tile.tile()) |
| 295 last_tile = prioritized_tile; | 172 last_tile = prioritized_tile; |
| 296 | 173 |
| 297 EXPECT_LE(last_tile.priority().priority_bin, | 174 EXPECT_LE(last_tile.priority().priority_bin, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 326 queue->Pop(); | 203 queue->Pop(); |
| 327 } | 204 } |
| 328 | 205 |
| 329 EXPECT_EQ(tile_count, smoothness_tiles.size()); | 206 EXPECT_EQ(tile_count, smoothness_tiles.size()); |
| 330 EXPECT_EQ(all_tiles, smoothness_tiles); | 207 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 331 // Since we don't guarantee increasing distance due to spiral iterator, we | 208 // Since we don't guarantee increasing distance due to spiral iterator, we |
| 332 // should check that we're _mostly_ right. | 209 // should check that we're _mostly_ right. |
| 333 EXPECT_GT(correct_order_tiles, 3 * tile_count / 4); | 210 EXPECT_GT(correct_order_tiles, 3 * tile_count / 4); |
| 334 | 211 |
| 335 // Check that we have consistent required_for_activation tiles. | 212 // Check that we have consistent required_for_activation tiles. |
| 336 queue = host_impl_.BuildRasterQueue( | 213 queue = host_impl()->BuildRasterQueue( |
| 337 SMOOTHNESS_TAKES_PRIORITY, | 214 SMOOTHNESS_TAKES_PRIORITY, |
| 338 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); | 215 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 339 required_for_activation_tiles.clear(); | 216 required_for_activation_tiles.clear(); |
| 340 while (!queue->IsEmpty()) { | 217 while (!queue->IsEmpty()) { |
| 341 PrioritizedTile prioritized_tile = queue->Top(); | 218 PrioritizedTile prioritized_tile = queue->Top(); |
| 342 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); | 219 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); |
| 343 required_for_activation_tiles.insert(prioritized_tile.tile()); | 220 required_for_activation_tiles.insert(prioritized_tile.tile()); |
| 344 queue->Pop(); | 221 queue->Pop(); |
| 345 } | 222 } |
| 346 EXPECT_EQ(expected_required_for_activation_tiles, | 223 EXPECT_EQ(expected_required_for_activation_tiles, |
| 347 required_for_activation_tiles); | 224 required_for_activation_tiles); |
| 348 EXPECT_NE(all_tiles, required_for_activation_tiles); | 225 EXPECT_NE(all_tiles, required_for_activation_tiles); |
| 349 | 226 |
| 350 // Check that we have consistent required_for_draw tiles. | 227 // Check that we have consistent required_for_draw tiles. |
| 351 queue = host_impl_.BuildRasterQueue( | 228 queue = host_impl()->BuildRasterQueue( |
| 352 SMOOTHNESS_TAKES_PRIORITY, | 229 SMOOTHNESS_TAKES_PRIORITY, |
| 353 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 230 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 354 required_for_draw_tiles.clear(); | 231 required_for_draw_tiles.clear(); |
| 355 while (!queue->IsEmpty()) { | 232 while (!queue->IsEmpty()) { |
| 356 PrioritizedTile prioritized_tile = queue->Top(); | 233 PrioritizedTile prioritized_tile = queue->Top(); |
| 357 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); | 234 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); |
| 358 required_for_draw_tiles.insert(prioritized_tile.tile()); | 235 required_for_draw_tiles.insert(prioritized_tile.tile()); |
| 359 queue->Pop(); | 236 queue->Pop(); |
| 360 } | 237 } |
| 361 EXPECT_EQ(expected_required_for_draw_tiles, required_for_draw_tiles); | 238 EXPECT_EQ(expected_required_for_draw_tiles, required_for_draw_tiles); |
| 362 EXPECT_NE(all_tiles, required_for_draw_tiles); | 239 EXPECT_NE(all_tiles, required_for_draw_tiles); |
| 363 | 240 |
| 364 std::set<Tile*> new_content_tiles; | 241 std::set<Tile*> new_content_tiles; |
| 365 last_tile = PrioritizedTile(); | 242 last_tile = PrioritizedTile(); |
| 366 size_t increasing_distance_tiles = 0u; | 243 size_t increasing_distance_tiles = 0u; |
| 367 // Here we expect to get increasing PENDING_TREE priority_bin. | 244 // Here we expect to get increasing PENDING_TREE priority_bin. |
| 368 queue = host_impl_.BuildRasterQueue(NEW_CONTENT_TAKES_PRIORITY, | 245 queue = host_impl()->BuildRasterQueue(NEW_CONTENT_TAKES_PRIORITY, |
| 369 RasterTilePriorityQueue::Type::ALL); | 246 RasterTilePriorityQueue::Type::ALL); |
| 370 tile_count = 0; | 247 tile_count = 0; |
| 371 while (!queue->IsEmpty()) { | 248 while (!queue->IsEmpty()) { |
| 372 PrioritizedTile prioritized_tile = queue->Top(); | 249 PrioritizedTile prioritized_tile = queue->Top(); |
| 373 EXPECT_TRUE(prioritized_tile.tile()); | 250 EXPECT_TRUE(prioritized_tile.tile()); |
| 374 | 251 |
| 375 if (!last_tile.tile()) | 252 if (!last_tile.tile()) |
| 376 last_tile = prioritized_tile; | 253 last_tile = prioritized_tile; |
| 377 | 254 |
| 378 EXPECT_LE(last_tile.priority().priority_bin, | 255 EXPECT_LE(last_tile.priority().priority_bin, |
| 379 prioritized_tile.priority().priority_bin); | 256 prioritized_tile.priority().priority_bin); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 397 queue->Pop(); | 274 queue->Pop(); |
| 398 } | 275 } |
| 399 | 276 |
| 400 EXPECT_EQ(tile_count, new_content_tiles.size()); | 277 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 401 EXPECT_EQ(high_res_tiles, new_content_tiles); | 278 EXPECT_EQ(high_res_tiles, new_content_tiles); |
| 402 // Since we don't guarantee increasing distance due to spiral iterator, we | 279 // Since we don't guarantee increasing distance due to spiral iterator, we |
| 403 // should check that we're _mostly_ right. | 280 // should check that we're _mostly_ right. |
| 404 EXPECT_GE(increasing_distance_tiles, 3 * tile_count / 4); | 281 EXPECT_GE(increasing_distance_tiles, 3 * tile_count / 4); |
| 405 | 282 |
| 406 // Check that we have consistent required_for_activation tiles. | 283 // Check that we have consistent required_for_activation tiles. |
| 407 queue = host_impl_.BuildRasterQueue( | 284 queue = host_impl()->BuildRasterQueue( |
| 408 NEW_CONTENT_TAKES_PRIORITY, | 285 NEW_CONTENT_TAKES_PRIORITY, |
| 409 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); | 286 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 410 required_for_activation_tiles.clear(); | 287 required_for_activation_tiles.clear(); |
| 411 while (!queue->IsEmpty()) { | 288 while (!queue->IsEmpty()) { |
| 412 PrioritizedTile prioritized_tile = queue->Top(); | 289 PrioritizedTile prioritized_tile = queue->Top(); |
| 413 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); | 290 EXPECT_TRUE(prioritized_tile.tile()->required_for_activation()); |
| 414 required_for_activation_tiles.insert(prioritized_tile.tile()); | 291 required_for_activation_tiles.insert(prioritized_tile.tile()); |
| 415 queue->Pop(); | 292 queue->Pop(); |
| 416 } | 293 } |
| 417 EXPECT_EQ(expected_required_for_activation_tiles, | 294 EXPECT_EQ(expected_required_for_activation_tiles, |
| 418 required_for_activation_tiles); | 295 required_for_activation_tiles); |
| 419 EXPECT_NE(new_content_tiles, required_for_activation_tiles); | 296 EXPECT_NE(new_content_tiles, required_for_activation_tiles); |
| 420 | 297 |
| 421 // Check that we have consistent required_for_draw tiles. | 298 // Check that we have consistent required_for_draw tiles. |
| 422 queue = host_impl_.BuildRasterQueue( | 299 queue = host_impl()->BuildRasterQueue( |
| 423 NEW_CONTENT_TAKES_PRIORITY, | 300 NEW_CONTENT_TAKES_PRIORITY, |
| 424 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 301 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 425 required_for_draw_tiles.clear(); | 302 required_for_draw_tiles.clear(); |
| 426 while (!queue->IsEmpty()) { | 303 while (!queue->IsEmpty()) { |
| 427 PrioritizedTile prioritized_tile = queue->Top(); | 304 PrioritizedTile prioritized_tile = queue->Top(); |
| 428 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); | 305 EXPECT_TRUE(prioritized_tile.tile()->required_for_draw()); |
| 429 required_for_draw_tiles.insert(prioritized_tile.tile()); | 306 required_for_draw_tiles.insert(prioritized_tile.tile()); |
| 430 queue->Pop(); | 307 queue->Pop(); |
| 431 } | 308 } |
| 432 EXPECT_EQ(expected_required_for_draw_tiles, required_for_draw_tiles); | 309 EXPECT_EQ(expected_required_for_draw_tiles, required_for_draw_tiles); |
| 433 EXPECT_NE(new_content_tiles, required_for_draw_tiles); | 310 EXPECT_NE(new_content_tiles, required_for_draw_tiles); |
| 434 } | 311 } |
| 435 | 312 |
| 436 TEST_F(TileManagerTilePriorityQueueTest, | 313 TEST_F(TileManagerTilePriorityQueueTest, |
| 437 RasterTilePriorityQueueHighNonIdealTilings) { | 314 RasterTilePriorityQueueHighNonIdealTilings) { |
| 438 const gfx::Size layer_bounds(1000, 1000); | 315 const gfx::Size layer_bounds(1000, 1000); |
| 439 const gfx::Size viewport(800, 800); | 316 const gfx::Size viewport(800, 800); |
| 440 host_impl_.SetViewportSize(viewport); | 317 host_impl()->SetViewportSize(viewport); |
| 441 SetupDefaultTrees(layer_bounds); | 318 SetupDefaultTrees(layer_bounds); |
| 442 | 319 |
| 443 pending_layer_->tilings()->AddTiling(1.5f, pending_layer_->raster_source()); | 320 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); |
| 444 active_layer_->tilings()->AddTiling(1.5f, active_layer_->raster_source()); | 321 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); |
| 445 pending_layer_->tilings()->AddTiling(1.7f, pending_layer_->raster_source()); | 322 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); |
| 446 active_layer_->tilings()->AddTiling(1.7f, active_layer_->raster_source()); | 323 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); |
| 447 | 324 |
| 448 pending_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 325 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, |
| 326 5.0, Occlusion(), true); |
| 327 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 449 Occlusion(), true); | 328 Occlusion(), true); |
| 450 active_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | |
| 451 Occlusion(), true); | |
| 452 | 329 |
| 453 std::set<Tile*> all_expected_tiles; | 330 std::set<Tile*> all_expected_tiles; |
| 454 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 331 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { |
| 455 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 332 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); |
| 456 if (tiling->contents_scale() == 1.f) { | 333 if (tiling->contents_scale() == 1.f) { |
| 457 tiling->set_resolution(HIGH_RESOLUTION); | 334 tiling->set_resolution(HIGH_RESOLUTION); |
| 458 const auto& all_tiles = tiling->AllTilesForTesting(); | 335 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 459 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 336 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 460 } else { | 337 } else { |
| 461 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 338 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 462 } | 339 } |
| 463 } | 340 } |
| 464 | 341 |
| 465 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { | 342 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { |
| 466 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); | 343 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); |
| 467 if (tiling->contents_scale() == 1.5f) { | 344 if (tiling->contents_scale() == 1.5f) { |
| 468 tiling->set_resolution(HIGH_RESOLUTION); | 345 tiling->set_resolution(HIGH_RESOLUTION); |
| 469 const auto& all_tiles = tiling->AllTilesForTesting(); | 346 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 470 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 347 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 471 } else { | 348 } else { |
| 472 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 349 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 473 // Non ideal tilings with a high res pending twin have to be processed | 350 // Non ideal tilings with a high res pending twin have to be processed |
| 474 // because of possible activation tiles. | 351 // because of possible activation tiles. |
| 475 if (tiling->contents_scale() == 1.f) { | 352 if (tiling->contents_scale() == 1.f) { |
| 476 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 353 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 477 const auto& all_tiles = tiling->AllTilesForTesting(); | 354 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 478 for (auto* tile : all_tiles) | 355 for (auto* tile : all_tiles) |
| 479 EXPECT_TRUE(tile->required_for_activation()); | 356 EXPECT_TRUE(tile->required_for_activation()); |
| 480 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 357 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 481 } | 358 } |
| 482 } | 359 } |
| 483 } | 360 } |
| 484 | 361 |
| 485 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 362 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 486 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 363 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
| 487 EXPECT_FALSE(queue->IsEmpty()); | 364 EXPECT_FALSE(queue->IsEmpty()); |
| 488 | 365 |
| 489 size_t tile_count = 0; | 366 size_t tile_count = 0; |
| 490 std::set<Tile*> all_actual_tiles; | 367 std::set<Tile*> all_actual_tiles; |
| 491 while (!queue->IsEmpty()) { | 368 while (!queue->IsEmpty()) { |
| 492 EXPECT_TRUE(queue->Top().tile()); | 369 EXPECT_TRUE(queue->Top().tile()); |
| 493 all_actual_tiles.insert(queue->Top().tile()); | 370 all_actual_tiles.insert(queue->Top().tile()); |
| 494 ++tile_count; | 371 ++tile_count; |
| 495 queue->Pop(); | 372 queue->Pop(); |
| 496 } | 373 } |
| 497 | 374 |
| 498 EXPECT_EQ(tile_count, all_actual_tiles.size()); | 375 EXPECT_EQ(tile_count, all_actual_tiles.size()); |
| 499 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); | 376 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); |
| 500 EXPECT_EQ(all_expected_tiles, all_actual_tiles); | 377 EXPECT_EQ(all_expected_tiles, all_actual_tiles); |
| 501 } | 378 } |
| 502 | 379 |
| 503 TEST_F(TileManagerTilePriorityQueueTest, | 380 TEST_F(TileManagerTilePriorityQueueTest, |
| 504 RasterTilePriorityQueueHighLowTilings) { | 381 RasterTilePriorityQueueHighLowTilings) { |
| 505 const gfx::Size layer_bounds(1000, 1000); | 382 const gfx::Size layer_bounds(1000, 1000); |
| 506 const gfx::Size viewport(800, 800); | 383 const gfx::Size viewport(800, 800); |
| 507 host_impl_.SetViewportSize(viewport); | 384 host_impl()->SetViewportSize(viewport); |
| 508 SetupDefaultTrees(layer_bounds); | 385 SetupDefaultTrees(layer_bounds); |
| 509 | 386 |
| 510 pending_layer_->tilings()->AddTiling(1.5f, pending_layer_->raster_source()); | 387 pending_layer()->tilings()->AddTiling(1.5f, pending_layer()->raster_source()); |
| 511 active_layer_->tilings()->AddTiling(1.5f, active_layer_->raster_source()); | 388 active_layer()->tilings()->AddTiling(1.5f, active_layer()->raster_source()); |
| 512 pending_layer_->tilings()->AddTiling(1.7f, pending_layer_->raster_source()); | 389 pending_layer()->tilings()->AddTiling(1.7f, pending_layer()->raster_source()); |
| 513 active_layer_->tilings()->AddTiling(1.7f, active_layer_->raster_source()); | 390 active_layer()->tilings()->AddTiling(1.7f, active_layer()->raster_source()); |
| 514 | 391 |
| 515 pending_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | 392 pending_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, |
| 393 5.0, Occlusion(), true); |
| 394 active_layer()->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, |
| 516 Occlusion(), true); | 395 Occlusion(), true); |
| 517 active_layer_->tilings()->UpdateTilePriorities(gfx::Rect(viewport), 1.f, 5.0, | |
| 518 Occlusion(), true); | |
| 519 | 396 |
| 520 std::set<Tile*> all_expected_tiles; | 397 std::set<Tile*> all_expected_tiles; |
| 521 for (size_t i = 0; i < pending_layer_->num_tilings(); ++i) { | 398 for (size_t i = 0; i < pending_layer()->num_tilings(); ++i) { |
| 522 PictureLayerTiling* tiling = pending_layer_->tilings()->tiling_at(i); | 399 PictureLayerTiling* tiling = pending_layer()->tilings()->tiling_at(i); |
| 523 if (tiling->contents_scale() == 1.f) { | 400 if (tiling->contents_scale() == 1.f) { |
| 524 tiling->set_resolution(HIGH_RESOLUTION); | 401 tiling->set_resolution(HIGH_RESOLUTION); |
| 525 const auto& all_tiles = tiling->AllTilesForTesting(); | 402 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 526 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 403 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 527 } else { | 404 } else { |
| 528 tiling->set_resolution(NON_IDEAL_RESOLUTION); | 405 tiling->set_resolution(NON_IDEAL_RESOLUTION); |
| 529 } | 406 } |
| 530 } | 407 } |
| 531 | 408 |
| 532 for (size_t i = 0; i < active_layer_->num_tilings(); ++i) { | 409 for (size_t i = 0; i < active_layer()->num_tilings(); ++i) { |
| 533 PictureLayerTiling* tiling = active_layer_->tilings()->tiling_at(i); | 410 PictureLayerTiling* tiling = active_layer()->tilings()->tiling_at(i); |
| 534 if (tiling->contents_scale() == 1.5f) { | 411 if (tiling->contents_scale() == 1.5f) { |
| 535 tiling->set_resolution(HIGH_RESOLUTION); | 412 tiling->set_resolution(HIGH_RESOLUTION); |
| 536 const auto& all_tiles = tiling->AllTilesForTesting(); | 413 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 537 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 414 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 538 } else { | 415 } else { |
| 539 tiling->set_resolution(LOW_RESOLUTION); | 416 tiling->set_resolution(LOW_RESOLUTION); |
| 540 // Low res tilings with a high res pending twin have to be processed | 417 // Low res tilings with a high res pending twin have to be processed |
| 541 // because of possible activation tiles. | 418 // because of possible activation tiles. |
| 542 if (tiling->contents_scale() == 1.f) { | 419 if (tiling->contents_scale() == 1.f) { |
| 543 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 420 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
| 544 const auto& all_tiles = tiling->AllTilesForTesting(); | 421 const auto& all_tiles = tiling->AllTilesForTesting(); |
| 545 for (auto* tile : all_tiles) | 422 for (auto* tile : all_tiles) |
| 546 EXPECT_TRUE(tile->required_for_activation()); | 423 EXPECT_TRUE(tile->required_for_activation()); |
| 547 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 424 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
| 548 } | 425 } |
| 549 } | 426 } |
| 550 } | 427 } |
| 551 | 428 |
| 552 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 429 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 553 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 430 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 554 EXPECT_FALSE(queue->IsEmpty()); | 431 EXPECT_FALSE(queue->IsEmpty()); |
| 555 | 432 |
| 556 size_t tile_count = 0; | 433 size_t tile_count = 0; |
| 557 std::set<Tile*> all_actual_tiles; | 434 std::set<Tile*> all_actual_tiles; |
| 558 while (!queue->IsEmpty()) { | 435 while (!queue->IsEmpty()) { |
| 559 EXPECT_TRUE(queue->Top().tile()); | 436 EXPECT_TRUE(queue->Top().tile()); |
| 560 all_actual_tiles.insert(queue->Top().tile()); | 437 all_actual_tiles.insert(queue->Top().tile()); |
| 561 ++tile_count; | 438 ++tile_count; |
| 562 queue->Pop(); | 439 queue->Pop(); |
| 563 } | 440 } |
| 564 | 441 |
| 565 EXPECT_EQ(tile_count, all_actual_tiles.size()); | 442 EXPECT_EQ(tile_count, all_actual_tiles.size()); |
| 566 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); | 443 EXPECT_EQ(all_expected_tiles.size(), all_actual_tiles.size()); |
| 567 EXPECT_EQ(all_expected_tiles, all_actual_tiles); | 444 EXPECT_EQ(all_expected_tiles, all_actual_tiles); |
| 568 } | 445 } |
| 569 | 446 |
| 570 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { | 447 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueInvalidation) { |
| 571 const gfx::Size layer_bounds(1000, 1000); | 448 const gfx::Size layer_bounds(1000, 1000); |
| 572 host_impl_.SetViewportSize(gfx::Size(500, 500)); | 449 host_impl()->SetViewportSize(gfx::Size(500, 500)); |
| 573 SetupDefaultTrees(layer_bounds); | 450 SetupDefaultTrees(layer_bounds); |
| 574 | 451 |
| 575 // Use a tile's content rect as an invalidation. We should inset it a bit to | 452 // Use a tile's content rect as an invalidation. We should inset it a bit to |
| 576 // ensure that border math doesn't invalidate neighbouring tiles. | 453 // ensure that border math doesn't invalidate neighbouring tiles. |
| 577 gfx::Rect invalidation = | 454 gfx::Rect invalidation = |
| 578 active_layer_->HighResTiling()->TileAt(1, 0)->content_rect(); | 455 active_layer()->HighResTiling()->TileAt(1, 0)->content_rect(); |
| 579 invalidation.Inset(2, 2); | 456 invalidation.Inset(2, 2); |
| 580 | 457 |
| 581 pending_layer_->set_invalidation(invalidation); | 458 pending_layer()->set_invalidation(invalidation); |
| 582 pending_layer_->HighResTiling()->Invalidate(invalidation); | 459 pending_layer()->HighResTiling()->Invalidate(invalidation); |
| 583 pending_layer_->HighResTiling()->CreateMissingTilesInLiveTilesRect(); | 460 pending_layer()->HighResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 584 | 461 |
| 585 // Sanity checks: Tile at 0, 0 not exist on the pending tree (it's not | 462 // Sanity checks: Tile at 0, 0 not exist on the pending tree (it's not |
| 586 // invalidated). Tile 1, 0 should exist on both. | 463 // invalidated). Tile 1, 0 should exist on both. |
| 587 EXPECT_FALSE(pending_layer_->HighResTiling()->TileAt(0, 0)); | 464 EXPECT_FALSE(pending_layer()->HighResTiling()->TileAt(0, 0)); |
| 588 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(0, 0)); | 465 EXPECT_TRUE(active_layer()->HighResTiling()->TileAt(0, 0)); |
| 589 EXPECT_TRUE(pending_layer_->HighResTiling()->TileAt(1, 0)); | 466 EXPECT_TRUE(pending_layer()->HighResTiling()->TileAt(1, 0)); |
| 590 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(1, 0)); | 467 EXPECT_TRUE(active_layer()->HighResTiling()->TileAt(1, 0)); |
| 591 EXPECT_NE(pending_layer_->HighResTiling()->TileAt(1, 0), | 468 EXPECT_NE(pending_layer()->HighResTiling()->TileAt(1, 0), |
| 592 active_layer_->HighResTiling()->TileAt(1, 0)); | 469 active_layer()->HighResTiling()->TileAt(1, 0)); |
| 593 | 470 |
| 594 std::set<Tile*> expected_now_tiles; | 471 std::set<Tile*> expected_now_tiles; |
| 595 std::set<Tile*> expected_required_for_draw_tiles; | 472 std::set<Tile*> expected_required_for_draw_tiles; |
| 596 std::set<Tile*> expected_required_for_activation_tiles; | 473 std::set<Tile*> expected_required_for_activation_tiles; |
| 597 for (int i = 0; i <= 1; ++i) { | 474 for (int i = 0; i <= 1; ++i) { |
| 598 for (int j = 0; j <= 1; ++j) { | 475 for (int j = 0; j <= 1; ++j) { |
| 599 bool have_pending_tile = false; | 476 bool have_pending_tile = false; |
| 600 if (pending_layer_->HighResTiling()->TileAt(i, j)) { | 477 if (pending_layer()->HighResTiling()->TileAt(i, j)) { |
| 601 expected_now_tiles.insert( | 478 expected_now_tiles.insert( |
| 602 pending_layer_->HighResTiling()->TileAt(i, j)); | 479 pending_layer()->HighResTiling()->TileAt(i, j)); |
| 603 expected_required_for_activation_tiles.insert( | 480 expected_required_for_activation_tiles.insert( |
| 604 pending_layer_->HighResTiling()->TileAt(i, j)); | 481 pending_layer()->HighResTiling()->TileAt(i, j)); |
| 605 have_pending_tile = true; | 482 have_pending_tile = true; |
| 606 } | 483 } |
| 607 Tile* active_tile = active_layer_->HighResTiling()->TileAt(i, j); | 484 Tile* active_tile = active_layer()->HighResTiling()->TileAt(i, j); |
| 608 EXPECT_TRUE(active_tile); | 485 EXPECT_TRUE(active_tile); |
| 609 expected_now_tiles.insert(active_tile); | 486 expected_now_tiles.insert(active_tile); |
| 610 expected_required_for_draw_tiles.insert(active_tile); | 487 expected_required_for_draw_tiles.insert(active_tile); |
| 611 if (!have_pending_tile) | 488 if (!have_pending_tile) |
| 612 expected_required_for_activation_tiles.insert(active_tile); | 489 expected_required_for_activation_tiles.insert(active_tile); |
| 613 } | 490 } |
| 614 } | 491 } |
| 615 // Expect 3 shared tiles and 1 unshared tile in total. | 492 // Expect 3 shared tiles and 1 unshared tile in total. |
| 616 EXPECT_EQ(5u, expected_now_tiles.size()); | 493 EXPECT_EQ(5u, expected_now_tiles.size()); |
| 617 // Expect 4 tiles for each draw and activation, but not all the same. | 494 // Expect 4 tiles for each draw and activation, but not all the same. |
| 618 EXPECT_EQ(4u, expected_required_for_activation_tiles.size()); | 495 EXPECT_EQ(4u, expected_required_for_activation_tiles.size()); |
| 619 EXPECT_EQ(4u, expected_required_for_draw_tiles.size()); | 496 EXPECT_EQ(4u, expected_required_for_draw_tiles.size()); |
| 620 EXPECT_NE(expected_required_for_draw_tiles, | 497 EXPECT_NE(expected_required_for_draw_tiles, |
| 621 expected_required_for_activation_tiles); | 498 expected_required_for_activation_tiles); |
| 622 | 499 |
| 623 std::set<Tile*> expected_all_tiles; | 500 std::set<Tile*> expected_all_tiles; |
| 624 for (int i = 0; i <= 3; ++i) { | 501 for (int i = 0; i <= 3; ++i) { |
| 625 for (int j = 0; j <= 3; ++j) { | 502 for (int j = 0; j <= 3; ++j) { |
| 626 if (pending_layer_->HighResTiling()->TileAt(i, j)) | 503 if (pending_layer()->HighResTiling()->TileAt(i, j)) |
| 627 expected_all_tiles.insert( | 504 expected_all_tiles.insert( |
| 628 pending_layer_->HighResTiling()->TileAt(i, j)); | 505 pending_layer()->HighResTiling()->TileAt(i, j)); |
| 629 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(i, j)); | 506 EXPECT_TRUE(active_layer()->HighResTiling()->TileAt(i, j)); |
| 630 expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); | 507 expected_all_tiles.insert(active_layer()->HighResTiling()->TileAt(i, j)); |
| 631 } | 508 } |
| 632 } | 509 } |
| 633 // Expect 15 shared tiles and 1 unshared tile. | 510 // Expect 15 shared tiles and 1 unshared tile. |
| 634 EXPECT_EQ(17u, expected_all_tiles.size()); | 511 EXPECT_EQ(17u, expected_all_tiles.size()); |
| 635 | 512 |
| 636 // The actual test will now build different queues and verify that the queues | 513 // The actual test will now build different queues and verify that the queues |
| 637 // return the same information as computed manually above. | 514 // return the same information as computed manually above. |
| 638 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 515 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 639 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 516 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 640 std::set<Tile*> actual_now_tiles; | 517 std::set<Tile*> actual_now_tiles; |
| 641 std::set<Tile*> actual_all_tiles; | 518 std::set<Tile*> actual_all_tiles; |
| 642 while (!queue->IsEmpty()) { | 519 while (!queue->IsEmpty()) { |
| 643 PrioritizedTile prioritized_tile = queue->Top(); | 520 PrioritizedTile prioritized_tile = queue->Top(); |
| 644 queue->Pop(); | 521 queue->Pop(); |
| 645 if (prioritized_tile.priority().priority_bin == TilePriority::NOW) | 522 if (prioritized_tile.priority().priority_bin == TilePriority::NOW) |
| 646 actual_now_tiles.insert(prioritized_tile.tile()); | 523 actual_now_tiles.insert(prioritized_tile.tile()); |
| 647 actual_all_tiles.insert(prioritized_tile.tile()); | 524 actual_all_tiles.insert(prioritized_tile.tile()); |
| 648 } | 525 } |
| 649 EXPECT_EQ(expected_now_tiles, actual_now_tiles); | 526 EXPECT_EQ(expected_now_tiles, actual_now_tiles); |
| 650 EXPECT_EQ(expected_all_tiles, actual_all_tiles); | 527 EXPECT_EQ(expected_all_tiles, actual_all_tiles); |
| 651 | 528 |
| 652 queue = host_impl_.BuildRasterQueue( | 529 queue = host_impl()->BuildRasterQueue( |
| 653 SAME_PRIORITY_FOR_BOTH_TREES, | 530 SAME_PRIORITY_FOR_BOTH_TREES, |
| 654 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); | 531 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 655 std::set<Tile*> actual_required_for_draw_tiles; | 532 std::set<Tile*> actual_required_for_draw_tiles; |
| 656 while (!queue->IsEmpty()) { | 533 while (!queue->IsEmpty()) { |
| 657 PrioritizedTile prioritized_tile = queue->Top(); | 534 PrioritizedTile prioritized_tile = queue->Top(); |
| 658 queue->Pop(); | 535 queue->Pop(); |
| 659 actual_required_for_draw_tiles.insert(prioritized_tile.tile()); | 536 actual_required_for_draw_tiles.insert(prioritized_tile.tile()); |
| 660 } | 537 } |
| 661 EXPECT_EQ(expected_required_for_draw_tiles, actual_required_for_draw_tiles); | 538 EXPECT_EQ(expected_required_for_draw_tiles, actual_required_for_draw_tiles); |
| 662 | 539 |
| 663 queue = host_impl_.BuildRasterQueue( | 540 queue = host_impl()->BuildRasterQueue( |
| 664 SAME_PRIORITY_FOR_BOTH_TREES, | 541 SAME_PRIORITY_FOR_BOTH_TREES, |
| 665 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); | 542 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 666 std::set<Tile*> actual_required_for_activation_tiles; | 543 std::set<Tile*> actual_required_for_activation_tiles; |
| 667 while (!queue->IsEmpty()) { | 544 while (!queue->IsEmpty()) { |
| 668 Tile* tile = queue->Top().tile(); | 545 Tile* tile = queue->Top().tile(); |
| 669 queue->Pop(); | 546 queue->Pop(); |
| 670 actual_required_for_activation_tiles.insert(tile); | 547 actual_required_for_activation_tiles.insert(tile); |
| 671 } | 548 } |
| 672 EXPECT_EQ(expected_required_for_activation_tiles, | 549 EXPECT_EQ(expected_required_for_activation_tiles, |
| 673 actual_required_for_activation_tiles); | 550 actual_required_for_activation_tiles); |
| 674 } | 551 } |
| 675 | 552 |
| 676 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { | 553 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { |
| 677 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 554 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 678 | 555 |
| 679 gfx::Size layer_bounds(1000, 1000); | 556 gfx::Size layer_bounds(1000, 1000); |
| 680 SetupDefaultTrees(layer_bounds); | 557 SetupDefaultTrees(layer_bounds); |
| 681 | 558 |
| 682 // Create a pending child layer. | 559 // Create a pending child layer. |
| 683 scoped_refptr<FakeRasterSource> pending_raster_source = | 560 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 684 FakeRasterSource::CreateFilled(layer_bounds); | 561 FakeRasterSource::CreateFilled(layer_bounds); |
| 685 std::unique_ptr<FakePictureLayerImpl> pending_child = | 562 std::unique_ptr<FakePictureLayerImpl> pending_child = |
| 686 FakePictureLayerImpl::CreateWithRasterSource( | 563 FakePictureLayerImpl::CreateWithRasterSource( |
| 687 host_impl_.pending_tree(), id_ + 1, pending_raster_source); | 564 host_impl()->pending_tree(), layer_id() + 1, pending_raster_source); |
| 688 FakePictureLayerImpl* pending_child_raw = pending_child.get(); | 565 FakePictureLayerImpl* pending_child_raw = pending_child.get(); |
| 689 pending_child_raw->SetDrawsContent(true); | 566 pending_child_raw->SetDrawsContent(true); |
| 690 pending_layer_->AddChild(std::move(pending_child)); | 567 pending_layer()->AddChild(std::move(pending_child)); |
| 691 | 568 |
| 692 // Set a small viewport, so we have soon and eventually tiles. | 569 // Set a small viewport, so we have soon and eventually tiles. |
| 693 host_impl_.SetViewportSize(gfx::Size(200, 200)); | 570 host_impl()->SetViewportSize(gfx::Size(200, 200)); |
| 694 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 571 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 695 bool update_lcd_text = false; | 572 bool update_lcd_text = false; |
| 696 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; | 573 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; |
| 697 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | 574 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); |
| 698 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 575 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 699 | 576 |
| 700 host_impl_.SetRequiresHighResToDraw(); | 577 host_impl()->SetRequiresHighResToDraw(); |
| 701 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 578 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 702 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 579 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
| 703 EXPECT_FALSE(queue->IsEmpty()); | 580 EXPECT_FALSE(queue->IsEmpty()); |
| 704 | 581 |
| 705 // Get all the tiles that are NOW or SOON and make sure they are ready to | 582 // Get all the tiles that are NOW or SOON and make sure they are ready to |
| 706 // draw. | 583 // draw. |
| 707 std::vector<Tile*> all_tiles; | 584 std::vector<Tile*> all_tiles; |
| 708 while (!queue->IsEmpty()) { | 585 while (!queue->IsEmpty()) { |
| 709 PrioritizedTile prioritized_tile = queue->Top(); | 586 PrioritizedTile prioritized_tile = queue->Top(); |
| 710 if (prioritized_tile.priority().priority_bin >= TilePriority::EVENTUALLY) | 587 if (prioritized_tile.priority().priority_bin >= TilePriority::EVENTUALLY) |
| 711 break; | 588 break; |
| 712 | 589 |
| 713 all_tiles.push_back(prioritized_tile.tile()); | 590 all_tiles.push_back(prioritized_tile.tile()); |
| 714 queue->Pop(); | 591 queue->Pop(); |
| 715 } | 592 } |
| 716 | 593 |
| 717 tile_manager()->InitializeTilesWithResourcesForTesting( | 594 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 718 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 595 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 719 | 596 |
| 720 // Ensure we can activate. | 597 // Ensure we can activate. |
| 721 EXPECT_TRUE(tile_manager()->IsReadyToActivate()); | 598 EXPECT_TRUE(tile_manager()->IsReadyToActivate()); |
| 722 } | 599 } |
| 723 | 600 |
| 724 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { | 601 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { |
| 725 const gfx::Size layer_bounds(1000, 1000); | 602 const gfx::Size layer_bounds(1000, 1000); |
| 726 host_impl_.SetViewportSize(layer_bounds); | 603 host_impl()->SetViewportSize(layer_bounds); |
| 727 SetupDefaultTrees(layer_bounds); | 604 SetupDefaultTrees(layer_bounds); |
| 728 ASSERT_TRUE(active_layer_->HighResTiling()); | 605 ASSERT_TRUE(active_layer()->HighResTiling()); |
| 729 ASSERT_TRUE(active_layer_->LowResTiling()); | 606 ASSERT_TRUE(active_layer()->LowResTiling()); |
| 730 ASSERT_TRUE(pending_layer_->HighResTiling()); | 607 ASSERT_TRUE(pending_layer()->HighResTiling()); |
| 731 EXPECT_FALSE(pending_layer_->LowResTiling()); | 608 EXPECT_FALSE(pending_layer()->LowResTiling()); |
| 732 | 609 |
| 733 std::unique_ptr<EvictionTilePriorityQueue> empty_queue( | 610 std::unique_ptr<EvictionTilePriorityQueue> empty_queue( |
| 734 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); | 611 host_impl()->BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); |
| 735 EXPECT_TRUE(empty_queue->IsEmpty()); | 612 EXPECT_TRUE(empty_queue->IsEmpty()); |
| 736 std::set<Tile*> all_tiles; | 613 std::set<Tile*> all_tiles; |
| 737 size_t tile_count = 0; | 614 size_t tile_count = 0; |
| 738 | 615 |
| 739 std::unique_ptr<RasterTilePriorityQueue> raster_queue( | 616 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
| 740 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, | 617 host_impl()->BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 741 RasterTilePriorityQueue::Type::ALL)); | 618 RasterTilePriorityQueue::Type::ALL)); |
| 742 while (!raster_queue->IsEmpty()) { | 619 while (!raster_queue->IsEmpty()) { |
| 743 ++tile_count; | 620 ++tile_count; |
| 744 EXPECT_TRUE(raster_queue->Top().tile()); | 621 EXPECT_TRUE(raster_queue->Top().tile()); |
| 745 all_tiles.insert(raster_queue->Top().tile()); | 622 all_tiles.insert(raster_queue->Top().tile()); |
| 746 raster_queue->Pop(); | 623 raster_queue->Pop(); |
| 747 } | 624 } |
| 748 | 625 |
| 749 EXPECT_EQ(tile_count, all_tiles.size()); | 626 EXPECT_EQ(tile_count, all_tiles.size()); |
| 750 EXPECT_EQ(16u, tile_count); | 627 EXPECT_EQ(16u, tile_count); |
| 751 | 628 |
| 752 tile_manager()->InitializeTilesWithResourcesForTesting( | 629 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 753 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 630 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 754 | 631 |
| 755 std::unique_ptr<EvictionTilePriorityQueue> queue( | 632 std::unique_ptr<EvictionTilePriorityQueue> queue( |
| 756 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); | 633 host_impl()->BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); |
| 757 EXPECT_FALSE(queue->IsEmpty()); | 634 EXPECT_FALSE(queue->IsEmpty()); |
| 758 | 635 |
| 759 // Sanity check, all tiles should be visible. | 636 // Sanity check, all tiles should be visible. |
| 760 std::set<Tile*> smoothness_tiles; | 637 std::set<Tile*> smoothness_tiles; |
| 761 while (!queue->IsEmpty()) { | 638 while (!queue->IsEmpty()) { |
| 762 PrioritizedTile prioritized_tile = queue->Top(); | 639 PrioritizedTile prioritized_tile = queue->Top(); |
| 763 EXPECT_TRUE(prioritized_tile.tile()); | 640 EXPECT_TRUE(prioritized_tile.tile()); |
| 764 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); | 641 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); |
| 765 EXPECT_TRUE(prioritized_tile.tile()->draw_info().has_resource()); | 642 EXPECT_TRUE(prioritized_tile.tile()->draw_info().has_resource()); |
| 766 smoothness_tiles.insert(prioritized_tile.tile()); | 643 smoothness_tiles.insert(prioritized_tile.tile()); |
| 767 queue->Pop(); | 644 queue->Pop(); |
| 768 } | 645 } |
| 769 EXPECT_EQ(all_tiles, smoothness_tiles); | 646 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 770 | 647 |
| 771 tile_manager()->ReleaseTileResourcesForTesting( | 648 tile_manager()->ReleaseTileResourcesForTesting( |
| 772 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 649 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 773 | 650 |
| 774 Region invalidation(gfx::Rect(0, 0, 500, 500)); | 651 Region invalidation(gfx::Rect(0, 0, 500, 500)); |
| 775 | 652 |
| 776 // Invalidate the pending tree. | 653 // Invalidate the pending tree. |
| 777 pending_layer_->set_invalidation(invalidation); | 654 pending_layer()->set_invalidation(invalidation); |
| 778 pending_layer_->HighResTiling()->Invalidate(invalidation); | 655 pending_layer()->HighResTiling()->Invalidate(invalidation); |
| 779 pending_layer_->HighResTiling()->CreateMissingTilesInLiveTilesRect(); | 656 pending_layer()->HighResTiling()->CreateMissingTilesInLiveTilesRect(); |
| 780 EXPECT_FALSE(pending_layer_->LowResTiling()); | 657 EXPECT_FALSE(pending_layer()->LowResTiling()); |
| 781 | 658 |
| 782 // Renew all of the tile priorities. | 659 // Renew all of the tile priorities. |
| 783 gfx::Rect viewport(50, 50, 100, 100); | 660 gfx::Rect viewport(50, 50, 100, 100); |
| 784 pending_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 661 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 785 viewport, 1.0f, 1.0, Occlusion(), true); | 662 viewport, 1.0f, 1.0, Occlusion(), true); |
| 786 active_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 663 active_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 787 viewport, 1.0f, 1.0, Occlusion(), true); | 664 viewport, 1.0f, 1.0, Occlusion(), true); |
| 788 | 665 |
| 789 // Populate all tiles directly from the tilings. | 666 // Populate all tiles directly from the tilings. |
| 790 all_tiles.clear(); | 667 all_tiles.clear(); |
| 791 std::vector<Tile*> pending_high_res_tiles = | 668 std::vector<Tile*> pending_high_res_tiles = |
| 792 pending_layer_->HighResTiling()->AllTilesForTesting(); | 669 pending_layer()->HighResTiling()->AllTilesForTesting(); |
| 793 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) | 670 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) |
| 794 all_tiles.insert(pending_high_res_tiles[i]); | 671 all_tiles.insert(pending_high_res_tiles[i]); |
| 795 | 672 |
| 796 std::vector<Tile*> active_high_res_tiles = | 673 std::vector<Tile*> active_high_res_tiles = |
| 797 active_layer_->HighResTiling()->AllTilesForTesting(); | 674 active_layer()->HighResTiling()->AllTilesForTesting(); |
| 798 for (size_t i = 0; i < active_high_res_tiles.size(); ++i) | 675 for (size_t i = 0; i < active_high_res_tiles.size(); ++i) |
| 799 all_tiles.insert(active_high_res_tiles[i]); | 676 all_tiles.insert(active_high_res_tiles[i]); |
| 800 | 677 |
| 801 std::vector<Tile*> active_low_res_tiles = | 678 std::vector<Tile*> active_low_res_tiles = |
| 802 active_layer_->LowResTiling()->AllTilesForTesting(); | 679 active_layer()->LowResTiling()->AllTilesForTesting(); |
| 803 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) | 680 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) |
| 804 all_tiles.insert(active_low_res_tiles[i]); | 681 all_tiles.insert(active_low_res_tiles[i]); |
| 805 | 682 |
| 806 tile_manager()->InitializeTilesWithResourcesForTesting( | 683 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 807 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 684 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 808 | 685 |
| 809 PrioritizedTile last_tile; | 686 PrioritizedTile last_tile; |
| 810 smoothness_tiles.clear(); | 687 smoothness_tiles.clear(); |
| 811 tile_count = 0; | 688 tile_count = 0; |
| 812 // Here we expect to get increasing combined priority_bin. | 689 // Here we expect to get increasing combined priority_bin. |
| 813 queue = host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY); | 690 queue = host_impl()->BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY); |
| 814 int distance_increasing = 0; | 691 int distance_increasing = 0; |
| 815 int distance_decreasing = 0; | 692 int distance_decreasing = 0; |
| 816 while (!queue->IsEmpty()) { | 693 while (!queue->IsEmpty()) { |
| 817 PrioritizedTile prioritized_tile = queue->Top(); | 694 PrioritizedTile prioritized_tile = queue->Top(); |
| 818 Tile* tile = prioritized_tile.tile(); | 695 Tile* tile = prioritized_tile.tile(); |
| 819 EXPECT_TRUE(tile); | 696 EXPECT_TRUE(tile); |
| 820 EXPECT_TRUE(tile->draw_info().has_resource()); | 697 EXPECT_TRUE(tile->draw_info().has_resource()); |
| 821 | 698 |
| 822 if (!last_tile.tile()) | 699 if (!last_tile.tile()) |
| 823 last_tile = prioritized_tile; | 700 last_tile = prioritized_tile; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 846 | 723 |
| 847 // Ensure that the distance is decreasing many more times than increasing. | 724 // Ensure that the distance is decreasing many more times than increasing. |
| 848 EXPECT_EQ(3, distance_increasing); | 725 EXPECT_EQ(3, distance_increasing); |
| 849 EXPECT_EQ(16, distance_decreasing); | 726 EXPECT_EQ(16, distance_decreasing); |
| 850 EXPECT_EQ(tile_count, smoothness_tiles.size()); | 727 EXPECT_EQ(tile_count, smoothness_tiles.size()); |
| 851 EXPECT_EQ(all_tiles, smoothness_tiles); | 728 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 852 | 729 |
| 853 std::set<Tile*> new_content_tiles; | 730 std::set<Tile*> new_content_tiles; |
| 854 last_tile = PrioritizedTile(); | 731 last_tile = PrioritizedTile(); |
| 855 // Again, we expect to get increasing combined priority_bin. | 732 // Again, we expect to get increasing combined priority_bin. |
| 856 queue = host_impl_.BuildEvictionQueue(NEW_CONTENT_TAKES_PRIORITY); | 733 queue = host_impl()->BuildEvictionQueue(NEW_CONTENT_TAKES_PRIORITY); |
| 857 distance_decreasing = 0; | 734 distance_decreasing = 0; |
| 858 distance_increasing = 0; | 735 distance_increasing = 0; |
| 859 while (!queue->IsEmpty()) { | 736 while (!queue->IsEmpty()) { |
| 860 PrioritizedTile prioritized_tile = queue->Top(); | 737 PrioritizedTile prioritized_tile = queue->Top(); |
| 861 Tile* tile = prioritized_tile.tile(); | 738 Tile* tile = prioritized_tile.tile(); |
| 862 EXPECT_TRUE(tile); | 739 EXPECT_TRUE(tile); |
| 863 | 740 |
| 864 if (!last_tile.tile()) | 741 if (!last_tile.tile()) |
| 865 last_tile = prioritized_tile; | 742 last_tile = prioritized_tile; |
| 866 | 743 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 887 | 764 |
| 888 // Ensure that the distance is decreasing many more times than increasing. | 765 // Ensure that the distance is decreasing many more times than increasing. |
| 889 EXPECT_EQ(3, distance_increasing); | 766 EXPECT_EQ(3, distance_increasing); |
| 890 EXPECT_EQ(16, distance_decreasing); | 767 EXPECT_EQ(16, distance_decreasing); |
| 891 EXPECT_EQ(tile_count, new_content_tiles.size()); | 768 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 892 EXPECT_EQ(all_tiles, new_content_tiles); | 769 EXPECT_EQ(all_tiles, new_content_tiles); |
| 893 } | 770 } |
| 894 | 771 |
| 895 TEST_F(TileManagerTilePriorityQueueTest, | 772 TEST_F(TileManagerTilePriorityQueueTest, |
| 896 EvictionTilePriorityQueueWithOcclusion) { | 773 EvictionTilePriorityQueueWithOcclusion) { |
| 897 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 774 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 898 | 775 |
| 899 gfx::Size layer_bounds(1000, 1000); | 776 gfx::Size layer_bounds(1000, 1000); |
| 900 | 777 |
| 901 host_impl_.SetViewportSize(layer_bounds); | 778 host_impl()->SetViewportSize(layer_bounds); |
| 902 | 779 |
| 903 scoped_refptr<FakeRasterSource> pending_raster_source = | 780 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 904 FakeRasterSource::CreateFilled(layer_bounds); | 781 FakeRasterSource::CreateFilled(layer_bounds); |
| 905 SetupPendingTree(pending_raster_source); | 782 SetupPendingTree(pending_raster_source); |
| 906 | 783 |
| 907 std::unique_ptr<FakePictureLayerImpl> pending_child = | 784 std::unique_ptr<FakePictureLayerImpl> pending_child = |
| 908 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, | 785 FakePictureLayerImpl::CreateWithRasterSource(host_impl()->pending_tree(), |
| 909 pending_raster_source); | 786 2, pending_raster_source); |
| 910 pending_layer_->AddChild(std::move(pending_child)); | 787 pending_layer()->AddChild(std::move(pending_child)); |
| 911 | 788 |
| 912 FakePictureLayerImpl* pending_child_layer = | 789 FakePictureLayerImpl* pending_child_layer = |
| 913 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); | 790 static_cast<FakePictureLayerImpl*>(pending_layer()->children()[0]); |
| 914 pending_child_layer->SetDrawsContent(true); | 791 pending_child_layer->SetDrawsContent(true); |
| 915 | 792 |
| 916 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 793 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 917 bool update_lcd_text = false; | 794 bool update_lcd_text = false; |
| 918 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; | 795 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; |
| 919 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | 796 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); |
| 920 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 797 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 921 | 798 |
| 922 ActivateTree(); | 799 ActivateTree(); |
| 923 SetupPendingTree(pending_raster_source); | 800 SetupPendingTree(pending_raster_source); |
| 924 | 801 |
| 925 FakePictureLayerImpl* active_child_layer = | 802 FakePictureLayerImpl* active_child_layer = |
| 926 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]); | 803 static_cast<FakePictureLayerImpl*>(active_layer()->children()[0]); |
| 927 | 804 |
| 928 std::set<Tile*> all_tiles; | 805 std::set<Tile*> all_tiles; |
| 929 size_t tile_count = 0; | 806 size_t tile_count = 0; |
| 930 std::unique_ptr<RasterTilePriorityQueue> raster_queue( | 807 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
| 931 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, | 808 host_impl()->BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 932 RasterTilePriorityQueue::Type::ALL)); | 809 RasterTilePriorityQueue::Type::ALL)); |
| 933 while (!raster_queue->IsEmpty()) { | 810 while (!raster_queue->IsEmpty()) { |
| 934 ++tile_count; | 811 ++tile_count; |
| 935 EXPECT_TRUE(raster_queue->Top().tile()); | 812 EXPECT_TRUE(raster_queue->Top().tile()); |
| 936 all_tiles.insert(raster_queue->Top().tile()); | 813 all_tiles.insert(raster_queue->Top().tile()); |
| 937 raster_queue->Pop(); | 814 raster_queue->Pop(); |
| 938 } | 815 } |
| 939 EXPECT_EQ(tile_count, all_tiles.size()); | 816 EXPECT_EQ(tile_count, all_tiles.size()); |
| 940 EXPECT_EQ(32u, tile_count); | 817 EXPECT_EQ(32u, tile_count); |
| 941 | 818 |
| 942 // Renew all of the tile priorities. | 819 // Renew all of the tile priorities. |
| 943 gfx::Rect viewport(layer_bounds); | 820 gfx::Rect viewport(layer_bounds); |
| 944 pending_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 821 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 945 viewport, 1.0f, 1.0, Occlusion(), true); | 822 viewport, 1.0f, 1.0, Occlusion(), true); |
| 946 pending_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( | 823 pending_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( |
| 947 viewport, 1.0f, 1.0, Occlusion(), true); | 824 viewport, 1.0f, 1.0, Occlusion(), true); |
| 948 | 825 |
| 949 active_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 826 active_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 950 viewport, 1.0f, 1.0, Occlusion(), true); | 827 viewport, 1.0f, 1.0, Occlusion(), true); |
| 951 active_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( | 828 active_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( |
| 952 viewport, 1.0f, 1.0, Occlusion(), true); | 829 viewport, 1.0f, 1.0, Occlusion(), true); |
| 953 | 830 |
| 954 // Populate all tiles directly from the tilings. | 831 // Populate all tiles directly from the tilings. |
| 955 all_tiles.clear(); | 832 all_tiles.clear(); |
| 956 std::vector<Tile*> pending_high_res_tiles = | 833 std::vector<Tile*> pending_high_res_tiles = |
| 957 pending_layer_->HighResTiling()->AllTilesForTesting(); | 834 pending_layer()->HighResTiling()->AllTilesForTesting(); |
| 958 all_tiles.insert(pending_high_res_tiles.begin(), | 835 all_tiles.insert(pending_high_res_tiles.begin(), |
| 959 pending_high_res_tiles.end()); | 836 pending_high_res_tiles.end()); |
| 960 | 837 |
| 961 // Set all tiles on the pending_child_layer as occluded on the pending tree. | 838 // Set all tiles on the pending_child_layer as occluded on the pending tree. |
| 962 std::vector<Tile*> pending_child_high_res_tiles = | 839 std::vector<Tile*> pending_child_high_res_tiles = |
| 963 pending_child_layer->HighResTiling()->AllTilesForTesting(); | 840 pending_child_layer->HighResTiling()->AllTilesForTesting(); |
| 964 pending_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); | 841 pending_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); |
| 965 active_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); | 842 active_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); |
| 966 active_child_layer->LowResTiling()->SetAllTilesOccludedForTesting(); | 843 active_child_layer->LowResTiling()->SetAllTilesOccludedForTesting(); |
| 967 | 844 |
| 968 tile_manager()->InitializeTilesWithResourcesForTesting( | 845 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 969 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 846 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 970 | 847 |
| 971 // Verify occlusion is considered by EvictionTilePriorityQueue. | 848 // Verify occlusion is considered by EvictionTilePriorityQueue. |
| 972 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 849 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
| 973 size_t occluded_count = 0u; | 850 size_t occluded_count = 0u; |
| 974 PrioritizedTile last_tile; | 851 PrioritizedTile last_tile; |
| 975 std::unique_ptr<EvictionTilePriorityQueue> queue( | 852 std::unique_ptr<EvictionTilePriorityQueue> queue( |
| 976 host_impl_.BuildEvictionQueue(tree_priority)); | 853 host_impl()->BuildEvictionQueue(tree_priority)); |
| 977 while (!queue->IsEmpty()) { | 854 while (!queue->IsEmpty()) { |
| 978 PrioritizedTile prioritized_tile = queue->Top(); | 855 PrioritizedTile prioritized_tile = queue->Top(); |
| 979 if (!last_tile.tile()) | 856 if (!last_tile.tile()) |
| 980 last_tile = prioritized_tile; | 857 last_tile = prioritized_tile; |
| 981 | 858 |
| 982 bool tile_is_occluded = prioritized_tile.is_occluded(); | 859 bool tile_is_occluded = prioritized_tile.is_occluded(); |
| 983 | 860 |
| 984 // The only way we will encounter an occluded tile after an unoccluded | 861 // The only way we will encounter an occluded tile after an unoccluded |
| 985 // tile is if the priorty bin decreased, the tile is required for | 862 // tile is if the priorty bin decreased, the tile is required for |
| 986 // activation, or the scale changed. | 863 // activation, or the scale changed. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1002 } | 879 } |
| 1003 last_tile = prioritized_tile; | 880 last_tile = prioritized_tile; |
| 1004 queue->Pop(); | 881 queue->Pop(); |
| 1005 } | 882 } |
| 1006 size_t expected_occluded_count = pending_child_high_res_tiles.size(); | 883 size_t expected_occluded_count = pending_child_high_res_tiles.size(); |
| 1007 EXPECT_EQ(expected_occluded_count, occluded_count); | 884 EXPECT_EQ(expected_occluded_count, occluded_count); |
| 1008 } | 885 } |
| 1009 | 886 |
| 1010 TEST_F(TileManagerTilePriorityQueueTest, | 887 TEST_F(TileManagerTilePriorityQueueTest, |
| 1011 EvictionTilePriorityQueueWithTransparentLayer) { | 888 EvictionTilePriorityQueueWithTransparentLayer) { |
| 1012 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 889 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 1013 | 890 |
| 1014 gfx::Size layer_bounds(1000, 1000); | 891 gfx::Size layer_bounds(1000, 1000); |
| 1015 | 892 |
| 1016 scoped_refptr<FakeRasterSource> pending_raster_source = | 893 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 1017 FakeRasterSource::CreateFilled(layer_bounds); | 894 FakeRasterSource::CreateFilled(layer_bounds); |
| 1018 SetupPendingTree(pending_raster_source); | 895 SetupPendingTree(pending_raster_source); |
| 1019 | 896 |
| 1020 std::unique_ptr<FakePictureLayerImpl> pending_child = | 897 std::unique_ptr<FakePictureLayerImpl> pending_child = |
| 1021 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, | 898 FakePictureLayerImpl::CreateWithRasterSource(host_impl()->pending_tree(), |
| 1022 pending_raster_source); | 899 2, pending_raster_source); |
| 1023 FakePictureLayerImpl* pending_child_layer = pending_child.get(); | 900 FakePictureLayerImpl* pending_child_layer = pending_child.get(); |
| 1024 pending_layer_->AddChild(std::move(pending_child)); | 901 pending_layer()->AddChild(std::move(pending_child)); |
| 1025 | 902 |
| 1026 // Create a fully transparent child layer so that its tile priorities are not | 903 // Create a fully transparent child layer so that its tile priorities are not |
| 1027 // considered to be valid. | 904 // considered to be valid. |
| 1028 pending_child_layer->SetDrawsContent(true); | 905 pending_child_layer->SetDrawsContent(true); |
| 1029 pending_child_layer->test_properties()->force_render_surface = true; | 906 pending_child_layer->test_properties()->force_render_surface = true; |
| 1030 | 907 |
| 1031 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 908 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 1032 bool update_lcd_text = false; | 909 bool update_lcd_text = false; |
| 1033 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; | 910 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; |
| 1034 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | 911 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); |
| 1035 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 912 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 1036 | 913 |
| 1037 pending_child_layer->OnOpacityAnimated(0.0); | 914 pending_child_layer->OnOpacityAnimated(0.0); |
| 1038 | 915 |
| 1039 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 916 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 1040 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 917 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 1041 | 918 |
| 1042 // Renew all of the tile priorities. | 919 // Renew all of the tile priorities. |
| 1043 gfx::Rect viewport(layer_bounds); | 920 gfx::Rect viewport(layer_bounds); |
| 1044 pending_layer_->picture_layer_tiling_set()->UpdateTilePriorities( | 921 pending_layer()->picture_layer_tiling_set()->UpdateTilePriorities( |
| 1045 viewport, 1.0f, 1.0, Occlusion(), true); | 922 viewport, 1.0f, 1.0, Occlusion(), true); |
| 1046 pending_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( | 923 pending_child_layer->picture_layer_tiling_set()->UpdateTilePriorities( |
| 1047 viewport, 1.0f, 1.0, Occlusion(), true); | 924 viewport, 1.0f, 1.0, Occlusion(), true); |
| 1048 | 925 |
| 1049 // Populate all tiles directly from the tilings. | 926 // Populate all tiles directly from the tilings. |
| 1050 std::set<Tile*> all_pending_tiles; | 927 std::set<Tile*> all_pending_tiles; |
| 1051 std::vector<Tile*> pending_high_res_tiles = | 928 std::vector<Tile*> pending_high_res_tiles = |
| 1052 pending_layer_->HighResTiling()->AllTilesForTesting(); | 929 pending_layer()->HighResTiling()->AllTilesForTesting(); |
| 1053 all_pending_tiles.insert(pending_high_res_tiles.begin(), | 930 all_pending_tiles.insert(pending_high_res_tiles.begin(), |
| 1054 pending_high_res_tiles.end()); | 931 pending_high_res_tiles.end()); |
| 1055 EXPECT_EQ(16u, pending_high_res_tiles.size()); | 932 EXPECT_EQ(16u, pending_high_res_tiles.size()); |
| 1056 | 933 |
| 1057 std::set<Tile*> all_pending_child_tiles; | 934 std::set<Tile*> all_pending_child_tiles; |
| 1058 std::vector<Tile*> pending_child_high_res_tiles = | 935 std::vector<Tile*> pending_child_high_res_tiles = |
| 1059 pending_child_layer->HighResTiling()->AllTilesForTesting(); | 936 pending_child_layer->HighResTiling()->AllTilesForTesting(); |
| 1060 all_pending_child_tiles.insert(pending_child_high_res_tiles.begin(), | 937 all_pending_child_tiles.insert(pending_child_high_res_tiles.begin(), |
| 1061 pending_child_high_res_tiles.end()); | 938 pending_child_high_res_tiles.end()); |
| 1062 EXPECT_EQ(16u, pending_child_high_res_tiles.size()); | 939 EXPECT_EQ(16u, pending_child_high_res_tiles.size()); |
| 1063 | 940 |
| 1064 std::set<Tile*> all_tiles = all_pending_tiles; | 941 std::set<Tile*> all_tiles = all_pending_tiles; |
| 1065 all_tiles.insert(all_pending_child_tiles.begin(), | 942 all_tiles.insert(all_pending_child_tiles.begin(), |
| 1066 all_pending_child_tiles.end()); | 943 all_pending_child_tiles.end()); |
| 1067 | 944 |
| 1068 tile_manager()->InitializeTilesWithResourcesForTesting( | 945 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 1069 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 946 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 1070 | 947 |
| 1071 EXPECT_TRUE(pending_layer_->HasValidTilePriorities()); | 948 EXPECT_TRUE(pending_layer()->HasValidTilePriorities()); |
| 1072 EXPECT_FALSE(pending_child_layer->HasValidTilePriorities()); | 949 EXPECT_FALSE(pending_child_layer->HasValidTilePriorities()); |
| 1073 | 950 |
| 1074 // Verify that eviction queue returns tiles also from layers without valid | 951 // Verify that eviction queue returns tiles also from layers without valid |
| 1075 // tile priorities and that the tile priority bin of those tiles is (at most) | 952 // tile priorities and that the tile priority bin of those tiles is (at most) |
| 1076 // EVENTUALLY. | 953 // EVENTUALLY. |
| 1077 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 954 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
| 1078 std::set<Tile*> new_content_tiles; | 955 std::set<Tile*> new_content_tiles; |
| 1079 size_t tile_count = 0; | 956 size_t tile_count = 0; |
| 1080 std::unique_ptr<EvictionTilePriorityQueue> queue( | 957 std::unique_ptr<EvictionTilePriorityQueue> queue( |
| 1081 host_impl_.BuildEvictionQueue(tree_priority)); | 958 host_impl()->BuildEvictionQueue(tree_priority)); |
| 1082 while (!queue->IsEmpty()) { | 959 while (!queue->IsEmpty()) { |
| 1083 PrioritizedTile prioritized_tile = queue->Top(); | 960 PrioritizedTile prioritized_tile = queue->Top(); |
| 1084 Tile* tile = prioritized_tile.tile(); | 961 Tile* tile = prioritized_tile.tile(); |
| 1085 const TilePriority& pending_priority = prioritized_tile.priority(); | 962 const TilePriority& pending_priority = prioritized_tile.priority(); |
| 1086 EXPECT_NE(std::numeric_limits<float>::infinity(), | 963 EXPECT_NE(std::numeric_limits<float>::infinity(), |
| 1087 pending_priority.distance_to_visible); | 964 pending_priority.distance_to_visible); |
| 1088 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) | 965 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) |
| 1089 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); | 966 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); |
| 1090 else | 967 else |
| 1091 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); | 968 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); |
| 1092 new_content_tiles.insert(tile); | 969 new_content_tiles.insert(tile); |
| 1093 ++tile_count; | 970 ++tile_count; |
| 1094 queue->Pop(); | 971 queue->Pop(); |
| 1095 } | 972 } |
| 1096 EXPECT_EQ(tile_count, new_content_tiles.size()); | 973 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 1097 EXPECT_EQ(all_tiles, new_content_tiles); | 974 EXPECT_EQ(all_tiles, new_content_tiles); |
| 1098 } | 975 } |
| 1099 | 976 |
| 1100 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { | 977 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { |
| 1101 const gfx::Size layer_bounds(1000, 1000); | 978 const gfx::Size layer_bounds(1000, 1000); |
| 1102 host_impl_.SetViewportSize(layer_bounds); | 979 host_impl()->SetViewportSize(layer_bounds); |
| 1103 SetupDefaultTrees(layer_bounds); | 980 SetupDefaultTrees(layer_bounds); |
| 1104 | 981 |
| 1105 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 982 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 1106 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 983 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 1107 EXPECT_FALSE(queue->IsEmpty()); | 984 EXPECT_FALSE(queue->IsEmpty()); |
| 1108 | 985 |
| 1109 size_t tile_count = 0; | 986 size_t tile_count = 0; |
| 1110 std::set<Tile*> all_tiles; | 987 std::set<Tile*> all_tiles; |
| 1111 while (!queue->IsEmpty()) { | 988 while (!queue->IsEmpty()) { |
| 1112 EXPECT_TRUE(queue->Top().tile()); | 989 EXPECT_TRUE(queue->Top().tile()); |
| 1113 all_tiles.insert(queue->Top().tile()); | 990 all_tiles.insert(queue->Top().tile()); |
| 1114 ++tile_count; | 991 ++tile_count; |
| 1115 queue->Pop(); | 992 queue->Pop(); |
| 1116 } | 993 } |
| 1117 | 994 |
| 1118 EXPECT_EQ(tile_count, all_tiles.size()); | 995 EXPECT_EQ(tile_count, all_tiles.size()); |
| 1119 EXPECT_EQ(16u, tile_count); | 996 EXPECT_EQ(16u, tile_count); |
| 1120 | 997 |
| 1121 for (int i = 1; i < 10; ++i) { | 998 for (int i = 1; i < 10; ++i) { |
| 1122 std::unique_ptr<FakePictureLayerImpl> pending_layer = | 999 std::unique_ptr<FakePictureLayerImpl> pending_child_layer = |
| 1123 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); | 1000 FakePictureLayerImpl::Create(host_impl()->pending_tree(), |
| 1124 pending_layer->SetDrawsContent(true); | 1001 layer_id() + i); |
| 1125 pending_layer->set_has_valid_tile_priorities(true); | 1002 pending_child_layer->SetDrawsContent(true); |
| 1126 pending_layer_->AddChild(std::move(pending_layer)); | 1003 pending_child_layer->set_has_valid_tile_priorities(true); |
| 1004 pending_layer()->AddChild(std::move(pending_child_layer)); |
| 1127 } | 1005 } |
| 1128 | 1006 |
| 1129 queue = host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, | 1007 queue = host_impl()->BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 1130 RasterTilePriorityQueue::Type::ALL); | 1008 RasterTilePriorityQueue::Type::ALL); |
| 1131 EXPECT_FALSE(queue->IsEmpty()); | 1009 EXPECT_FALSE(queue->IsEmpty()); |
| 1132 | 1010 |
| 1133 tile_count = 0; | 1011 tile_count = 0; |
| 1134 all_tiles.clear(); | 1012 all_tiles.clear(); |
| 1135 while (!queue->IsEmpty()) { | 1013 while (!queue->IsEmpty()) { |
| 1136 EXPECT_TRUE(queue->Top().tile()); | 1014 EXPECT_TRUE(queue->Top().tile()); |
| 1137 all_tiles.insert(queue->Top().tile()); | 1015 all_tiles.insert(queue->Top().tile()); |
| 1138 ++tile_count; | 1016 ++tile_count; |
| 1139 queue->Pop(); | 1017 queue->Pop(); |
| 1140 } | 1018 } |
| 1141 EXPECT_EQ(tile_count, all_tiles.size()); | 1019 EXPECT_EQ(tile_count, all_tiles.size()); |
| 1142 EXPECT_EQ(16u, tile_count); | 1020 EXPECT_EQ(16u, tile_count); |
| 1143 } | 1021 } |
| 1144 | 1022 |
| 1145 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { | 1023 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { |
| 1146 const gfx::Size layer_bounds(1000, 1000); | 1024 const gfx::Size layer_bounds(1000, 1000); |
| 1147 host_impl_.SetViewportSize(layer_bounds); | 1025 host_impl()->SetViewportSize(layer_bounds); |
| 1148 SetupDefaultTrees(layer_bounds); | 1026 SetupDefaultTrees(layer_bounds); |
| 1149 | 1027 |
| 1150 std::unique_ptr<RasterTilePriorityQueue> raster_queue( | 1028 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
| 1151 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, | 1029 host_impl()->BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 1152 RasterTilePriorityQueue::Type::ALL)); | 1030 RasterTilePriorityQueue::Type::ALL)); |
| 1153 EXPECT_FALSE(raster_queue->IsEmpty()); | 1031 EXPECT_FALSE(raster_queue->IsEmpty()); |
| 1154 | 1032 |
| 1155 size_t tile_count = 0; | 1033 size_t tile_count = 0; |
| 1156 std::set<Tile*> all_tiles; | 1034 std::set<Tile*> all_tiles; |
| 1157 while (!raster_queue->IsEmpty()) { | 1035 while (!raster_queue->IsEmpty()) { |
| 1158 EXPECT_TRUE(raster_queue->Top().tile()); | 1036 EXPECT_TRUE(raster_queue->Top().tile()); |
| 1159 all_tiles.insert(raster_queue->Top().tile()); | 1037 all_tiles.insert(raster_queue->Top().tile()); |
| 1160 ++tile_count; | 1038 ++tile_count; |
| 1161 raster_queue->Pop(); | 1039 raster_queue->Pop(); |
| 1162 } | 1040 } |
| 1163 EXPECT_EQ(tile_count, all_tiles.size()); | 1041 EXPECT_EQ(tile_count, all_tiles.size()); |
| 1164 EXPECT_EQ(16u, tile_count); | 1042 EXPECT_EQ(16u, tile_count); |
| 1165 | 1043 |
| 1166 std::vector<Tile*> tiles(all_tiles.begin(), all_tiles.end()); | 1044 std::vector<Tile*> tiles(all_tiles.begin(), all_tiles.end()); |
| 1167 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 1045 host_impl()->tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
| 1168 | 1046 |
| 1169 for (int i = 1; i < 10; ++i) { | 1047 for (int i = 1; i < 10; ++i) { |
| 1170 std::unique_ptr<FakePictureLayerImpl> pending_layer = | 1048 std::unique_ptr<FakePictureLayerImpl> pending_child_layer = |
| 1171 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); | 1049 FakePictureLayerImpl::Create(host_impl()->pending_tree(), |
| 1172 pending_layer->SetDrawsContent(true); | 1050 layer_id() + i); |
| 1173 pending_layer->set_has_valid_tile_priorities(true); | 1051 pending_child_layer->SetDrawsContent(true); |
| 1174 pending_layer_->AddChild(std::move(pending_layer)); | 1052 pending_child_layer->set_has_valid_tile_priorities(true); |
| 1053 pending_layer()->AddChild(std::move(pending_child_layer)); |
| 1175 } | 1054 } |
| 1176 | 1055 |
| 1177 std::unique_ptr<EvictionTilePriorityQueue> queue( | 1056 std::unique_ptr<EvictionTilePriorityQueue> queue( |
| 1178 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); | 1057 host_impl()->BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); |
| 1179 EXPECT_FALSE(queue->IsEmpty()); | 1058 EXPECT_FALSE(queue->IsEmpty()); |
| 1180 | 1059 |
| 1181 tile_count = 0; | 1060 tile_count = 0; |
| 1182 all_tiles.clear(); | 1061 all_tiles.clear(); |
| 1183 while (!queue->IsEmpty()) { | 1062 while (!queue->IsEmpty()) { |
| 1184 EXPECT_TRUE(queue->Top().tile()); | 1063 EXPECT_TRUE(queue->Top().tile()); |
| 1185 all_tiles.insert(queue->Top().tile()); | 1064 all_tiles.insert(queue->Top().tile()); |
| 1186 ++tile_count; | 1065 ++tile_count; |
| 1187 queue->Pop(); | 1066 queue->Pop(); |
| 1188 } | 1067 } |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1374 EXPECT_GT(eventually_bin_order_correct_count, | 1253 EXPECT_GT(eventually_bin_order_correct_count, |
| 1375 eventually_bin_order_incorrect_count); | 1254 eventually_bin_order_incorrect_count); |
| 1376 | 1255 |
| 1377 EXPECT_TRUE(have_tiles[TilePriority::NOW]); | 1256 EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
| 1378 EXPECT_TRUE(have_tiles[TilePriority::SOON]); | 1257 EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
| 1379 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); | 1258 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); |
| 1380 } | 1259 } |
| 1381 | 1260 |
| 1382 TEST_F(TileManagerTilePriorityQueueTest, SetIsLikelyToRequireADraw) { | 1261 TEST_F(TileManagerTilePriorityQueueTest, SetIsLikelyToRequireADraw) { |
| 1383 const gfx::Size layer_bounds(1000, 1000); | 1262 const gfx::Size layer_bounds(1000, 1000); |
| 1384 host_impl_.SetViewportSize(layer_bounds); | 1263 host_impl()->SetViewportSize(layer_bounds); |
| 1385 SetupDefaultTrees(layer_bounds); | 1264 SetupDefaultTrees(layer_bounds); |
| 1386 | 1265 |
| 1387 // Verify that the queue has a required for draw tile at Top. | 1266 // Verify that the queue has a required for draw tile at Top. |
| 1388 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1267 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 1389 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1268 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 1390 EXPECT_FALSE(queue->IsEmpty()); | 1269 EXPECT_FALSE(queue->IsEmpty()); |
| 1391 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1270 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
| 1392 | 1271 |
| 1393 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1272 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); |
| 1394 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1273 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1395 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw()); | 1274 EXPECT_TRUE(host_impl()->is_likely_to_require_a_draw()); |
| 1396 } | 1275 } |
| 1397 | 1276 |
| 1398 TEST_F(TileManagerTilePriorityQueueTest, | 1277 TEST_F(TileManagerTilePriorityQueueTest, |
| 1399 SetIsLikelyToRequireADrawOnZeroMemoryBudget) { | 1278 SetIsLikelyToRequireADrawOnZeroMemoryBudget) { |
| 1400 const gfx::Size layer_bounds(1000, 1000); | 1279 const gfx::Size layer_bounds(1000, 1000); |
| 1401 host_impl_.SetViewportSize(layer_bounds); | 1280 host_impl()->SetViewportSize(layer_bounds); |
| 1402 SetupDefaultTrees(layer_bounds); | 1281 SetupDefaultTrees(layer_bounds); |
| 1403 | 1282 |
| 1404 // Verify that the queue has a required for draw tile at Top. | 1283 // Verify that the queue has a required for draw tile at Top. |
| 1405 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1284 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 1406 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1285 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 1407 EXPECT_FALSE(queue->IsEmpty()); | 1286 EXPECT_FALSE(queue->IsEmpty()); |
| 1408 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1287 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
| 1409 | 1288 |
| 1410 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); | 1289 ManagedMemoryPolicy policy = host_impl()->ActualManagedMemoryPolicy(); |
| 1411 policy.bytes_limit_when_visible = 0; | 1290 policy.bytes_limit_when_visible = 0; |
| 1412 host_impl_.SetMemoryPolicy(policy); | 1291 host_impl()->SetMemoryPolicy(policy); |
| 1413 | 1292 |
| 1414 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1293 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); |
| 1415 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1294 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1416 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1295 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); |
| 1417 } | 1296 } |
| 1418 | 1297 |
| 1419 TEST_F(TileManagerTilePriorityQueueTest, | 1298 TEST_F(TileManagerTilePriorityQueueTest, |
| 1420 SetIsLikelyToRequireADrawOnLimitedMemoryBudget) { | 1299 SetIsLikelyToRequireADrawOnLimitedMemoryBudget) { |
| 1421 const gfx::Size layer_bounds(1000, 1000); | 1300 const gfx::Size layer_bounds(1000, 1000); |
| 1422 host_impl_.SetViewportSize(layer_bounds); | 1301 host_impl()->SetViewportSize(layer_bounds); |
| 1423 SetupDefaultTrees(layer_bounds); | 1302 SetupDefaultTrees(layer_bounds); |
| 1424 | 1303 |
| 1425 // Verify that the queue has a required for draw tile at Top. | 1304 // Verify that the queue has a required for draw tile at Top. |
| 1426 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1305 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 1427 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1306 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 1428 EXPECT_FALSE(queue->IsEmpty()); | 1307 EXPECT_FALSE(queue->IsEmpty()); |
| 1429 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1308 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
| 1430 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size()); | 1309 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size()); |
| 1431 EXPECT_EQ(RGBA_8888, host_impl_.resource_provider()->best_texture_format()); | 1310 EXPECT_EQ(RGBA_8888, host_impl()->resource_provider()->best_texture_format()); |
| 1432 | 1311 |
| 1433 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); | 1312 ManagedMemoryPolicy policy = host_impl()->ActualManagedMemoryPolicy(); |
| 1434 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>( | 1313 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>( |
| 1435 gfx::Size(256, 256), RGBA_8888); | 1314 gfx::Size(256, 256), RGBA_8888); |
| 1436 host_impl_.SetMemoryPolicy(policy); | 1315 host_impl()->SetMemoryPolicy(policy); |
| 1437 | 1316 |
| 1438 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1317 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); |
| 1439 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1318 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1440 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw()); | 1319 EXPECT_TRUE(host_impl()->is_likely_to_require_a_draw()); |
| 1441 | 1320 |
| 1442 Resource* resource = host_impl_.resource_pool()->AcquireResource( | 1321 Resource* resource = host_impl()->resource_pool()->AcquireResource( |
| 1443 gfx::Size(256, 256), RGBA_8888); | 1322 gfx::Size(256, 256), RGBA_8888); |
| 1444 | 1323 |
| 1445 host_impl_.tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); | 1324 host_impl()->tile_manager()->CheckIfMoreTilesNeedToBePreparedForTesting(); |
| 1446 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1325 EXPECT_FALSE(host_impl()->is_likely_to_require_a_draw()); |
| 1447 | 1326 |
| 1448 host_impl_.resource_pool()->ReleaseResource(resource, 0); | 1327 host_impl()->resource_pool()->ReleaseResource(resource, 0); |
| 1449 } | 1328 } |
| 1450 | 1329 |
| 1451 TEST_F(TileManagerTilePriorityQueueTest, DefaultMemoryPolicy) { | 1330 TEST_F(TileManagerTilePriorityQueueTest, DefaultMemoryPolicy) { |
| 1452 const gfx::Size layer_bounds(1000, 1000); | 1331 const gfx::Size layer_bounds(1000, 1000); |
| 1453 host_impl_.SetViewportSize(layer_bounds); | 1332 host_impl()->SetViewportSize(layer_bounds); |
| 1454 SetupDefaultTrees(layer_bounds); | 1333 SetupDefaultTrees(layer_bounds); |
| 1455 | 1334 |
| 1456 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1335 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1457 | 1336 |
| 1458 // 64MB is the default mem limit. | 1337 // 64MB is the default mem limit. |
| 1459 EXPECT_EQ(67108864u, | 1338 EXPECT_EQ(67108864u, |
| 1460 host_impl_.global_tile_state().hard_memory_limit_in_bytes); | 1339 host_impl()->global_tile_state().hard_memory_limit_in_bytes); |
| 1461 EXPECT_EQ(TileMemoryLimitPolicy::ALLOW_ANYTHING, | 1340 EXPECT_EQ(TileMemoryLimitPolicy::ALLOW_ANYTHING, |
| 1462 host_impl_.global_tile_state().memory_limit_policy); | 1341 host_impl()->global_tile_state().memory_limit_policy); |
| 1463 EXPECT_EQ(ManagedMemoryPolicy::kDefaultNumResourcesLimit, | 1342 EXPECT_EQ(ManagedMemoryPolicy::kDefaultNumResourcesLimit, |
| 1464 host_impl_.global_tile_state().num_resources_limit); | 1343 host_impl()->global_tile_state().num_resources_limit); |
| 1465 } | 1344 } |
| 1466 | 1345 |
| 1467 TEST_F(TileManagerTilePriorityQueueTest, RasterQueueAllUsesCorrectTileBounds) { | 1346 TEST_F(TileManagerTilePriorityQueueTest, RasterQueueAllUsesCorrectTileBounds) { |
| 1468 // Verify that we use the real tile bounds when advancing phases during the | 1347 // Verify that we use the real tile bounds when advancing phases during the |
| 1469 // tile iteration. | 1348 // tile iteration. |
| 1470 gfx::Size layer_bounds(1, 1); | 1349 gfx::Size layer_bounds(1, 1); |
| 1471 | 1350 |
| 1472 scoped_refptr<FakeRasterSource> raster_source = | 1351 scoped_refptr<FakeRasterSource> raster_source = |
| 1473 FakeRasterSource::CreateFilled(layer_bounds); | 1352 FakeRasterSource::CreateFilled(layer_bounds); |
| 1474 | 1353 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1545 non_solid_paint); | 1424 non_solid_paint); |
| 1546 recording_source->Rerecord(); | 1425 recording_source->Rerecord(); |
| 1547 | 1426 |
| 1548 scoped_refptr<RasterSource> raster_source = | 1427 scoped_refptr<RasterSource> raster_source = |
| 1549 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1428 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
| 1550 | 1429 |
| 1551 FakePictureLayerTilingClient tiling_client; | 1430 FakePictureLayerTilingClient tiling_client; |
| 1552 tiling_client.SetTileSize(size); | 1431 tiling_client.SetTileSize(size); |
| 1553 | 1432 |
| 1554 std::unique_ptr<PictureLayerImpl> layer_impl = | 1433 std::unique_ptr<PictureLayerImpl> layer_impl = |
| 1555 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false); | 1434 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false); |
| 1556 layer_impl->set_is_drawn_render_surface_layer_list_member(true); | 1435 layer_impl->set_is_drawn_render_surface_layer_list_member(true); |
| 1557 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); | 1436 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); |
| 1558 | 1437 |
| 1559 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1438 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
| 1560 tiling->set_resolution(HIGH_RESOLUTION); | 1439 tiling->set_resolution(HIGH_RESOLUTION); |
| 1561 tiling->CreateAllTilesForTesting(); | 1440 tiling->CreateAllTilesForTesting(); |
| 1562 tiling->SetTilePriorityRectsForTesting( | 1441 tiling->SetTilePriorityRectsForTesting( |
| 1563 gfx::Rect(layer_bounds), // Visible rect. | 1442 gfx::Rect(layer_bounds), // Visible rect. |
| 1564 gfx::Rect(layer_bounds), // Skewport rect. | 1443 gfx::Rect(layer_bounds), // Skewport rect. |
| 1565 gfx::Rect(layer_bounds), // Soon rect. | 1444 gfx::Rect(layer_bounds), // Soon rect. |
| 1566 gfx::Rect(layer_bounds)); // Eventually rect. | 1445 gfx::Rect(layer_bounds)); // Eventually rect. |
| 1567 | 1446 |
| 1568 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1447 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1569 | 1448 |
| 1570 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); | 1449 std::vector<Tile*> tiles = tiling->AllTilesForTesting(); |
| 1571 for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) { | 1450 for (size_t tile_idx = 0; tile_idx < tiles.size(); ++tile_idx) { |
| 1572 Tile* tile = tiles[tile_idx]; | 1451 Tile* tile = tiles[tile_idx]; |
| 1573 if (tile->id() == 1) { | 1452 if (tile->id() == 1) { |
| 1574 // Non-solid tile. | 1453 // Non-solid tile. |
| 1575 EXPECT_TRUE(tile->HasRasterTask()); | 1454 EXPECT_TRUE(tile->HasRasterTask()); |
| 1576 EXPECT_EQ(TileDrawInfo::RESOURCE_MODE, tile->draw_info().mode()); | 1455 EXPECT_EQ(TileDrawInfo::RESOURCE_MODE, tile->draw_info().mode()); |
| 1577 } else { | 1456 } else { |
| 1578 EXPECT_FALSE(tile->HasRasterTask()); | 1457 EXPECT_FALSE(tile->HasRasterTask()); |
| 1579 EXPECT_EQ(TileDrawInfo::SOLID_COLOR_MODE, tile->draw_info().mode()); | 1458 EXPECT_EQ(TileDrawInfo::SOLID_COLOR_MODE, tile->draw_info().mode()); |
| 1580 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); | 1459 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); |
| 1581 } | 1460 } |
| 1582 } | 1461 } |
| 1583 } | 1462 } |
| 1584 | 1463 |
| 1585 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. | 1464 class TileManagerTest : public TestLayerTreeHostBase { |
| 1586 class TileManagerTest : public testing::Test { | |
| 1587 public: | 1465 public: |
| 1588 void SetUp() override { | |
| 1589 LayerTreeSettings settings; | |
| 1590 settings.verify_clip_tree_calculations = true; | |
| 1591 | |
| 1592 CustomizeSettings(&settings); | |
| 1593 output_surface_ = GetOutputSurface(); | |
| 1594 task_graph_runner_ = GetTaskGraphRunner(); | |
| 1595 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, | |
| 1596 &shared_bitmap_manager_, | |
| 1597 task_graph_runner_.get())); | |
| 1598 host_impl_->SetVisible(true); | |
| 1599 host_impl_->InitializeRenderer(output_surface_.get()); | |
| 1600 } | |
| 1601 | |
| 1602 void SetupDefaultTrees(const gfx::Size& layer_bounds) { | |
| 1603 scoped_refptr<FakeRasterSource> pending_raster_source = | |
| 1604 FakeRasterSource::CreateFilled(layer_bounds); | |
| 1605 scoped_refptr<FakeRasterSource> active_raster_source = | |
| 1606 FakeRasterSource::CreateFilled(layer_bounds); | |
| 1607 | |
| 1608 SetupTrees(pending_raster_source, active_raster_source); | |
| 1609 } | |
| 1610 | |
| 1611 // This matches picture_layer_impl_unittest's ActivateTree. | |
| 1612 void ActivateTree() { | |
| 1613 host_impl_->ActivateSyncTree(); | |
| 1614 CHECK(!host_impl_->pending_tree()); | |
| 1615 bool update_lcd_text = false; | |
| 1616 host_impl_->active_tree()->UpdateDrawProperties(update_lcd_text); | |
| 1617 } | |
| 1618 | |
| 1619 void SetupTrees(scoped_refptr<RasterSource> pending_raster_source, | |
| 1620 scoped_refptr<RasterSource> active_raster_source) { | |
| 1621 SetupPendingTree(active_raster_source); | |
| 1622 ActivateTree(); | |
| 1623 SetupPendingTree(pending_raster_source); | |
| 1624 } | |
| 1625 | |
| 1626 void SetupPendingTree(scoped_refptr<RasterSource> raster_source) { | |
| 1627 host_impl_->CreatePendingTree(); | |
| 1628 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | |
| 1629 | |
| 1630 // Steal from the recycled tree. | |
| 1631 LayerImpl* old_pending_root = pending_tree->root_layer(); | |
| 1632 FakePictureLayerImpl* pending_layer = nullptr; | |
| 1633 if (old_pending_root) { | |
| 1634 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); | |
| 1635 pending_layer->SetRasterSourceOnPending(raster_source, Region()); | |
| 1636 } else { | |
| 1637 int id = 7; | |
| 1638 std::unique_ptr<FakePictureLayerImpl> new_root = | |
| 1639 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id, | |
| 1640 raster_source); | |
| 1641 pending_layer = new_root.get(); | |
| 1642 pending_layer->SetDrawsContent(true); | |
| 1643 pending_layer->SetHasRenderSurface(true); | |
| 1644 pending_tree->SetRootLayer(std::move(new_root)); | |
| 1645 } | |
| 1646 | |
| 1647 // The bounds() just mirror the raster source size. | |
| 1648 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | |
| 1649 | |
| 1650 // Add tilings/tiles for the layer. | |
| 1651 bool update_lcd_text = false; | |
| 1652 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | |
| 1653 host_impl_->pending_tree()->UpdateDrawProperties(update_lcd_text); | |
| 1654 } | |
| 1655 | |
| 1656 protected: | |
| 1657 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. | 1466 // MockLayerTreeHostImpl allows us to intercept tile manager callbacks. |
| 1658 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { | 1467 class MockLayerTreeHostImpl : public FakeLayerTreeHostImpl { |
| 1659 public: | 1468 public: |
| 1660 MockLayerTreeHostImpl(const LayerTreeSettings& settings, | 1469 MockLayerTreeHostImpl( |
| 1661 TaskRunnerProvider* task_runner_provider, | 1470 const LayerTreeSettings& settings, |
| 1662 SharedBitmapManager* manager, | 1471 TaskRunnerProvider* task_runner_provider, |
| 1663 TaskGraphRunner* task_graph_runner) | 1472 SharedBitmapManager* manager, |
| 1473 TaskGraphRunner* task_graph_runner, |
| 1474 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) |
| 1664 : FakeLayerTreeHostImpl(settings, | 1475 : FakeLayerTreeHostImpl(settings, |
| 1665 task_runner_provider, | 1476 task_runner_provider, |
| 1666 manager, | 1477 manager, |
| 1667 task_graph_runner) {} | 1478 task_graph_runner, |
| 1479 gpu_memory_buffer_manager) {} |
| 1668 | 1480 |
| 1669 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); | 1481 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); |
| 1670 MOCK_METHOD0(NotifyReadyToDraw, void()); | 1482 MOCK_METHOD0(NotifyReadyToDraw, void()); |
| 1671 }; | 1483 }; |
| 1672 | 1484 |
| 1673 // By default do no customization. | 1485 std::unique_ptr<FakeLayerTreeHostImpl> CreateHostImpl( |
| 1674 virtual void CustomizeSettings(LayerTreeSettings* settings) {} | 1486 const LayerTreeSettings& settings, |
| 1675 | 1487 TaskRunnerProvider* task_runner_provider, |
| 1676 // By default use TestTaskGraphRunner. | 1488 SharedBitmapManager* shared_bitmap_manager, |
| 1677 virtual std::unique_ptr<TaskGraphRunner> GetTaskGraphRunner() const { | 1489 TaskGraphRunner* task_graph_runner, |
| 1678 return base::WrapUnique(new TestTaskGraphRunner()); | 1490 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager) override { |
| 1491 return base::WrapUnique(new MockLayerTreeHostImpl( |
| 1492 settings, task_runner_provider, shared_bitmap_manager, |
| 1493 task_graph_runner, gpu_memory_buffer_manager)); |
| 1679 } | 1494 } |
| 1680 | 1495 |
| 1681 // By default use SoftwareOutputSurface. | 1496 // By default use SoftwareOutputSurface. |
| 1682 virtual std::unique_ptr<OutputSurface> GetOutputSurface() const { | 1497 std::unique_ptr<OutputSurface> CreateOutputSurface() override { |
| 1683 return FakeOutputSurface::CreateSoftware( | 1498 return FakeOutputSurface::CreateSoftware( |
| 1684 base::WrapUnique(new SoftwareOutputDevice)); | 1499 base::WrapUnique(new SoftwareOutputDevice)); |
| 1685 } | 1500 } |
| 1686 | 1501 |
| 1687 TestSharedBitmapManager shared_bitmap_manager_; | 1502 MockLayerTreeHostImpl& MockHostImpl() { |
| 1688 std::unique_ptr<TaskGraphRunner> task_graph_runner_; | 1503 return *static_cast<MockLayerTreeHostImpl*>(host_impl()); |
| 1689 FakeImplTaskRunnerProvider task_runner_provider_; | 1504 } |
| 1690 std::unique_ptr<OutputSurface> output_surface_; | |
| 1691 std::unique_ptr<MockLayerTreeHostImpl> host_impl_; | |
| 1692 }; | 1505 }; |
| 1693 | 1506 |
| 1694 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is | 1507 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is |
| 1695 // called. | 1508 // called. |
| 1696 TEST_F(TileManagerTest, AllWorkFinishedTest) { | 1509 TEST_F(TileManagerTest, AllWorkFinishedTest) { |
| 1697 // Check with no tile work enqueued. | 1510 // Check with no tile work enqueued. |
| 1698 { | 1511 { |
| 1699 base::RunLoop run_loop; | 1512 base::RunLoop run_loop; |
| 1700 EXPECT_FALSE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1513 EXPECT_FALSE( |
| 1701 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1514 host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1515 EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted()) |
| 1702 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1516 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1703 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); | 1517 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1704 EXPECT_TRUE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1518 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1705 run_loop.Run(); | 1519 run_loop.Run(); |
| 1706 } | 1520 } |
| 1707 | 1521 |
| 1708 // Check that the "schedule more work" path also triggers the expected | 1522 // Check that the "schedule more work" path also triggers the expected |
| 1709 // callback. | 1523 // callback. |
| 1710 { | 1524 { |
| 1711 base::RunLoop run_loop; | 1525 base::RunLoop run_loop; |
| 1712 EXPECT_FALSE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1526 EXPECT_FALSE( |
| 1713 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1527 host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1528 EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted()) |
| 1714 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1529 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1715 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); | 1530 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1716 host_impl_->tile_manager()->SetMoreTilesNeedToBeRasterizedForTesting(); | 1531 host_impl()->tile_manager()->SetMoreTilesNeedToBeRasterizedForTesting(); |
| 1717 EXPECT_TRUE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1532 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1718 run_loop.Run(); | 1533 run_loop.Run(); |
| 1719 } | 1534 } |
| 1720 } | 1535 } |
| 1721 | 1536 |
| 1722 TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) { | 1537 TEST_F(TileManagerTest, ActivateAndDrawWhenOOM) { |
| 1723 SetupDefaultTrees(gfx::Size(1000, 1000)); | 1538 SetupDefaultTrees(gfx::Size(1000, 1000)); |
| 1724 | 1539 |
| 1725 auto global_state = host_impl_->global_tile_state(); | 1540 auto global_state = host_impl()->global_tile_state(); |
| 1726 global_state.hard_memory_limit_in_bytes = 1u; | 1541 global_state.hard_memory_limit_in_bytes = 1u; |
| 1727 global_state.soft_memory_limit_in_bytes = 1u; | 1542 global_state.soft_memory_limit_in_bytes = 1u; |
| 1728 | 1543 |
| 1729 { | 1544 { |
| 1730 base::RunLoop run_loop; | 1545 base::RunLoop run_loop; |
| 1731 EXPECT_FALSE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1546 EXPECT_FALSE( |
| 1732 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1547 host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1548 EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted()) |
| 1733 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1549 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1734 host_impl_->tile_manager()->PrepareTiles(global_state); | 1550 host_impl()->tile_manager()->PrepareTiles(global_state); |
| 1735 EXPECT_TRUE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1551 EXPECT_TRUE(host_impl()->tile_manager()->HasScheduledTileTasksForTesting()); |
| 1736 run_loop.Run(); | 1552 run_loop.Run(); |
| 1737 } | 1553 } |
| 1738 | 1554 |
| 1739 EXPECT_TRUE(host_impl_->tile_manager()->IsReadyToDraw()); | 1555 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToDraw()); |
| 1740 EXPECT_TRUE(host_impl_->tile_manager()->IsReadyToActivate()); | 1556 EXPECT_TRUE(host_impl()->tile_manager()->IsReadyToActivate()); |
| 1741 EXPECT_TRUE(host_impl_->notify_tile_state_changed_called()); | 1557 EXPECT_TRUE(host_impl()->notify_tile_state_changed_called()); |
| 1742 | 1558 |
| 1743 // Next PrepareTiles should skip NotifyTileStateChanged since all tiles | 1559 // Next PrepareTiles should skip NotifyTileStateChanged since all tiles |
| 1744 // are marked oom already. | 1560 // are marked oom already. |
| 1745 { | 1561 { |
| 1746 base::RunLoop run_loop; | 1562 base::RunLoop run_loop; |
| 1747 host_impl_->set_notify_tile_state_changed_called(false); | 1563 host_impl()->set_notify_tile_state_changed_called(false); |
| 1748 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1564 EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted()) |
| 1749 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1565 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1750 host_impl_->tile_manager()->PrepareTiles(global_state); | 1566 host_impl()->tile_manager()->PrepareTiles(global_state); |
| 1751 run_loop.Run(); | 1567 run_loop.Run(); |
| 1752 EXPECT_FALSE(host_impl_->notify_tile_state_changed_called()); | 1568 EXPECT_FALSE(host_impl()->notify_tile_state_changed_called()); |
| 1753 } | 1569 } |
| 1754 } | 1570 } |
| 1755 | 1571 |
| 1756 TEST_F(TileManagerTest, LowResHasNoImage) { | 1572 TEST_F(TileManagerTest, LowResHasNoImage) { |
| 1757 gfx::Size size(10, 12); | 1573 gfx::Size size(10, 12); |
| 1758 TileResolution resolutions[] = {HIGH_RESOLUTION, LOW_RESOLUTION}; | 1574 TileResolution resolutions[] = {HIGH_RESOLUTION, LOW_RESOLUTION}; |
| 1759 | 1575 |
| 1760 for (size_t i = 0; i < arraysize(resolutions); ++i) { | 1576 for (size_t i = 0; i < arraysize(resolutions); ++i) { |
| 1761 SCOPED_TRACE(resolutions[i]); | 1577 SCOPED_TRACE(resolutions[i]); |
| 1762 | 1578 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1777 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); | 1593 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); |
| 1778 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); | 1594 recording_source->add_draw_image(std::move(blue_image), gfx::Point()); |
| 1779 recording_source->Rerecord(); | 1595 recording_source->Rerecord(); |
| 1780 scoped_refptr<RasterSource> raster = | 1596 scoped_refptr<RasterSource> raster = |
| 1781 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1597 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
| 1782 | 1598 |
| 1783 FakePictureLayerTilingClient tiling_client; | 1599 FakePictureLayerTilingClient tiling_client; |
| 1784 tiling_client.SetTileSize(size); | 1600 tiling_client.SetTileSize(size); |
| 1785 | 1601 |
| 1786 std::unique_ptr<PictureLayerImpl> layer = | 1602 std::unique_ptr<PictureLayerImpl> layer = |
| 1787 PictureLayerImpl::Create(host_impl_->active_tree(), 1, false); | 1603 PictureLayerImpl::Create(host_impl()->active_tree(), 1, false); |
| 1788 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); | 1604 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); |
| 1789 layer->set_is_drawn_render_surface_layer_list_member(true); | 1605 layer->set_is_drawn_render_surface_layer_list_member(true); |
| 1790 | 1606 |
| 1791 auto* tiling = tiling_set->AddTiling(1.0f, raster); | 1607 auto* tiling = tiling_set->AddTiling(1.0f, raster); |
| 1792 tiling->set_resolution(resolutions[i]); | 1608 tiling->set_resolution(resolutions[i]); |
| 1793 tiling->CreateAllTilesForTesting(); | 1609 tiling->CreateAllTilesForTesting(); |
| 1794 tiling->SetTilePriorityRectsForTesting( | 1610 tiling->SetTilePriorityRectsForTesting( |
| 1795 gfx::Rect(size), // Visible rect. | 1611 gfx::Rect(size), // Visible rect. |
| 1796 gfx::Rect(size), // Skewport rect. | 1612 gfx::Rect(size), // Skewport rect. |
| 1797 gfx::Rect(size), // Soon rect. | 1613 gfx::Rect(size), // Soon rect. |
| 1798 gfx::Rect(size)); // Eventually rect. | 1614 gfx::Rect(size)); // Eventually rect. |
| 1799 | 1615 |
| 1800 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster | 1616 // SMOOTHNESS_TAKES_PRIORITY ensures that we will actually raster |
| 1801 // LOW_RESOLUTION tiles, otherwise they are skipped. | 1617 // LOW_RESOLUTION tiles, otherwise they are skipped. |
| 1802 host_impl_->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); | 1618 host_impl()->SetTreePriority(SMOOTHNESS_TAKES_PRIORITY); |
| 1803 | 1619 |
| 1804 // Call PrepareTiles and wait for it to complete. | 1620 // Call PrepareTiles and wait for it to complete. |
| 1805 auto* tile_manager = host_impl_->tile_manager(); | 1621 auto* tile_manager = host_impl()->tile_manager(); |
| 1806 base::RunLoop run_loop; | 1622 base::RunLoop run_loop; |
| 1807 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1623 EXPECT_CALL(MockHostImpl(), NotifyAllTileTasksCompleted()) |
| 1808 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1624 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1809 tile_manager->PrepareTiles(host_impl_->global_tile_state()); | 1625 tile_manager->PrepareTiles(host_impl()->global_tile_state()); |
| 1810 run_loop.Run(); | 1626 run_loop.Run(); |
| 1811 tile_manager->Flush(); | 1627 tile_manager->Flush(); |
| 1812 | 1628 |
| 1813 Tile* tile = tiling->TileAt(0, 0); | 1629 Tile* tile = tiling->TileAt(0, 0); |
| 1814 // The tile in the tiling was rastered. | 1630 // The tile in the tiling was rastered. |
| 1815 EXPECT_EQ(TileDrawInfo::RESOURCE_MODE, tile->draw_info().mode()); | 1631 EXPECT_EQ(TileDrawInfo::RESOURCE_MODE, tile->draw_info().mode()); |
| 1816 EXPECT_TRUE(tile->draw_info().IsReadyToDraw()); | 1632 EXPECT_TRUE(tile->draw_info().IsReadyToDraw()); |
| 1817 | 1633 |
| 1818 ResourceProvider::ScopedReadLockSoftware lock( | 1634 ResourceProvider::ScopedReadLockSoftware lock( |
| 1819 host_impl_->resource_provider(), tile->draw_info().resource_id()); | 1635 host_impl()->resource_provider(), tile->draw_info().resource_id()); |
| 1820 const SkBitmap* bitmap = lock.sk_bitmap(); | 1636 const SkBitmap* bitmap = lock.sk_bitmap(); |
| 1821 for (int x = 0; x < size.width(); ++x) { | 1637 for (int x = 0; x < size.width(); ++x) { |
| 1822 for (int y = 0; y < size.height(); ++y) { | 1638 for (int y = 0; y < size.height(); ++y) { |
| 1823 SCOPED_TRACE(y); | 1639 SCOPED_TRACE(y); |
| 1824 SCOPED_TRACE(x); | 1640 SCOPED_TRACE(x); |
| 1825 if (resolutions[i] == LOW_RESOLUTION) { | 1641 if (resolutions[i] == LOW_RESOLUTION) { |
| 1826 // Since it's low res, the bitmap was not drawn, and the background | 1642 // Since it's low res, the bitmap was not drawn, and the background |
| 1827 // (green) is visible instead. | 1643 // (green) is visible instead. |
| 1828 ASSERT_EQ(SK_ColorGREEN, bitmap->getColor(x, y)); | 1644 ASSERT_EQ(SK_ColorGREEN, bitmap->getColor(x, y)); |
| 1829 } else { | 1645 } else { |
| 1830 EXPECT_EQ(HIGH_RESOLUTION, resolutions[i]); | 1646 EXPECT_EQ(HIGH_RESOLUTION, resolutions[i]); |
| 1831 // Since it's high res, the bitmap (blue) was drawn, and the | 1647 // Since it's high res, the bitmap (blue) was drawn, and the |
| 1832 // background is not visible. | 1648 // background is not visible. |
| 1833 ASSERT_EQ(SK_ColorBLUE, bitmap->getColor(x, y)); | 1649 ASSERT_EQ(SK_ColorBLUE, bitmap->getColor(x, y)); |
| 1834 } | 1650 } |
| 1835 } | 1651 } |
| 1836 } | 1652 } |
| 1837 } | 1653 } |
| 1838 } | 1654 } |
| 1839 | 1655 |
| 1840 class ActivationTasksDoNotBlockReadyToDrawTest : public TileManagerTest { | 1656 class ActivationTasksDoNotBlockReadyToDrawTest : public TileManagerTest { |
| 1841 protected: | 1657 protected: |
| 1842 std::unique_ptr<TaskGraphRunner> GetTaskGraphRunner() const override { | 1658 std::unique_ptr<TaskGraphRunner> CreateTaskGraphRunner() override { |
| 1843 return base::WrapUnique(new SynchronousTaskGraphRunner()); | 1659 return base::WrapUnique(new SynchronousTaskGraphRunner()); |
| 1844 } | 1660 } |
| 1845 | 1661 |
| 1846 std::unique_ptr<OutputSurface> GetOutputSurface() const override { | 1662 std::unique_ptr<OutputSurface> CreateOutputSurface() override { |
| 1847 return FakeOutputSurface::Create3d(); | 1663 return FakeOutputSurface::Create3d(); |
| 1848 } | 1664 } |
| 1849 | 1665 |
| 1850 void CustomizeSettings(LayerTreeSettings* settings) override { | 1666 LayerTreeSettings CreateSettings() override { |
| 1851 settings->gpu_rasterization_forced = true; | 1667 LayerTreeSettings settings = TileManagerTest::CreateSettings(); |
| 1852 } | 1668 settings.gpu_rasterization_forced = true; |
| 1853 | 1669 return settings; |
| 1854 SynchronousTaskGraphRunner* GetSynchronousTaskGraphRunner() const { | |
| 1855 return static_cast<SynchronousTaskGraphRunner*>(task_graph_runner_.get()); | |
| 1856 } | 1670 } |
| 1857 }; | 1671 }; |
| 1858 | 1672 |
| 1859 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, | 1673 TEST_F(ActivationTasksDoNotBlockReadyToDrawTest, |
| 1860 ActivationTasksDoNotBlockReadyToDraw) { | 1674 ActivationTasksDoNotBlockReadyToDraw) { |
| 1861 const gfx::Size layer_bounds(1000, 1000); | 1675 const gfx::Size layer_bounds(1000, 1000); |
| 1862 | 1676 |
| 1863 EXPECT_TRUE(host_impl_->use_gpu_rasterization()); | 1677 EXPECT_TRUE(host_impl()->use_gpu_rasterization()); |
| 1864 | 1678 |
| 1865 // Active tree has no non-solid tiles, so it will generate no tile tasks. | 1679 // Active tree has no non-solid tiles, so it will generate no tile tasks. |
| 1866 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = | 1680 std::unique_ptr<FakeRecordingSource> active_tree_recording_source = |
| 1867 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1681 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
| 1868 | 1682 |
| 1869 SkPaint solid_paint; | 1683 SkPaint solid_paint; |
| 1870 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1684 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
| 1871 solid_paint.setColor(solid_color); | 1685 solid_paint.setColor(solid_color); |
| 1872 active_tree_recording_source->add_draw_rect_with_paint( | 1686 active_tree_recording_source->add_draw_rect_with_paint( |
| 1873 gfx::Rect(layer_bounds), solid_paint); | 1687 gfx::Rect(layer_bounds), solid_paint); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1886 pending_tree_recording_source->Rerecord(); | 1700 pending_tree_recording_source->Rerecord(); |
| 1887 | 1701 |
| 1888 scoped_refptr<RasterSource> active_tree_raster_source = | 1702 scoped_refptr<RasterSource> active_tree_raster_source = |
| 1889 RasterSource::CreateFromRecordingSource( | 1703 RasterSource::CreateFromRecordingSource( |
| 1890 active_tree_recording_source.get(), false); | 1704 active_tree_recording_source.get(), false); |
| 1891 scoped_refptr<RasterSource> pending_tree_raster_source = | 1705 scoped_refptr<RasterSource> pending_tree_raster_source = |
| 1892 RasterSource::CreateFromRecordingSource( | 1706 RasterSource::CreateFromRecordingSource( |
| 1893 pending_tree_recording_source.get(), false); | 1707 pending_tree_recording_source.get(), false); |
| 1894 | 1708 |
| 1895 SetupTrees(pending_tree_raster_source, active_tree_raster_source); | 1709 SetupTrees(pending_tree_raster_source, active_tree_raster_source); |
| 1896 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); | 1710 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1897 | 1711 |
| 1898 // The first task to run should be ReadyToDraw (this should not be blocked by | 1712 // The first task to run should be ReadyToDraw (this should not be blocked by |
| 1899 // the tasks required for activation). | 1713 // the tasks required for activation). |
| 1900 base::RunLoop run_loop; | 1714 base::RunLoop run_loop; |
| 1901 EXPECT_CALL(*host_impl_, NotifyReadyToDraw()) | 1715 EXPECT_CALL(MockHostImpl(), NotifyReadyToDraw()) |
| 1902 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); | 1716 .WillOnce(testing::Invoke([&run_loop]() { run_loop.Quit(); })); |
| 1903 GetSynchronousTaskGraphRunner()->RunSingleTaskForTesting(); | 1717 static_cast<SynchronousTaskGraphRunner*>(task_graph_runner()) |
| 1718 ->RunSingleTaskForTesting(); |
| 1904 run_loop.Run(); | 1719 run_loop.Run(); |
| 1905 } | 1720 } |
| 1906 | 1721 |
| 1907 // Fake TileTaskManager that just cancels all scheduled tasks immediately. | 1722 // Fake TileTaskManager that just cancels all scheduled tasks immediately. |
| 1908 class CancellingTileTaskManager : public FakeTileTaskManagerImpl { | 1723 class CancellingTileTaskManager : public FakeTileTaskManagerImpl { |
| 1909 public: | 1724 public: |
| 1910 CancellingTileTaskManager() {} | 1725 CancellingTileTaskManager() {} |
| 1911 ~CancellingTileTaskManager() override {} | 1726 ~CancellingTileTaskManager() override {} |
| 1912 | 1727 |
| 1913 void ScheduleTasks(TaskGraph* graph) override { | 1728 void ScheduleTasks(TaskGraph* graph) override { |
| 1914 // Just call CompleteOnOriginThread on each item in the queue. As none of | 1729 // Just call CompleteOnOriginThread on each item in the queue. As none of |
| 1915 // these items have run yet, they will be treated as cancelled tasks. | 1730 // these items have run yet, they will be treated as cancelled tasks. |
| 1916 for (const auto& node : graph->nodes) { | 1731 for (const auto& node : graph->nodes) { |
| 1917 static_cast<TileTask*>(node.task)->CompleteOnOriginThread( | 1732 static_cast<TileTask*>(node.task)->CompleteOnOriginThread( |
| 1918 raster_buffer_provider_.get()); | 1733 raster_buffer_provider_.get()); |
| 1919 } | 1734 } |
| 1920 } | 1735 } |
| 1921 void CheckForCompletedTasks() override {} | 1736 void CheckForCompletedTasks() override {} |
| 1922 }; | 1737 }; |
| 1923 | 1738 |
| 1924 class PartialRasterTileManagerTest : public TileManagerTest { | 1739 class PartialRasterTileManagerTest : public TileManagerTest { |
| 1925 public: | 1740 public: |
| 1926 void CustomizeSettings(LayerTreeSettings* settings) override { | 1741 LayerTreeSettings CreateSettings() override { |
| 1927 settings->use_partial_raster = true; | 1742 LayerTreeSettings settings = TileManagerTest::CreateSettings(); |
| 1743 settings.use_partial_raster = true; |
| 1744 return settings; |
| 1928 } | 1745 } |
| 1929 }; | 1746 }; |
| 1930 | 1747 |
| 1931 // Ensures that if a raster task is cancelled, it gets returned to the resource | 1748 // Ensures that if a raster task is cancelled, it gets returned to the resource |
| 1932 // pool with an invalid content ID, not with its invalidated content ID. | 1749 // pool with an invalid content ID, not with its invalidated content ID. |
| 1933 TEST_F(PartialRasterTileManagerTest, CancelledTasksHaveNoContentId) { | 1750 TEST_F(PartialRasterTileManagerTest, CancelledTasksHaveNoContentId) { |
| 1934 // Create a CancellingTaskRunner and set it on the tile manager so that all | 1751 // Create a CancellingTaskRunner and set it on the tile manager so that all |
| 1935 // scheduled work is immediately cancelled. | 1752 // scheduled work is immediately cancelled. |
| 1936 CancellingTileTaskManager cancelling_task_manager; | 1753 CancellingTileTaskManager cancelling_task_manager; |
| 1937 host_impl_->tile_manager()->SetTileTaskManagerForTesting( | 1754 host_impl()->tile_manager()->SetTileTaskManagerForTesting( |
| 1938 &cancelling_task_manager); | 1755 &cancelling_task_manager); |
| 1939 | 1756 |
| 1940 // Pick arbitrary IDs - they don't really matter as long as they're constant. | 1757 // Pick arbitrary IDs - they don't really matter as long as they're constant. |
| 1941 const int kLayerId = 7; | 1758 const int kLayerId = 7; |
| 1942 const uint64_t kInvalidatedId = 43; | 1759 const uint64_t kInvalidatedId = 43; |
| 1943 const gfx::Size kTileSize(128, 128); | 1760 const gfx::Size kTileSize(128, 128); |
| 1944 | 1761 |
| 1945 scoped_refptr<FakeRasterSource> pending_raster_source = | 1762 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 1946 FakeRasterSource::CreateFilled(kTileSize); | 1763 FakeRasterSource::CreateFilled(kTileSize); |
| 1947 host_impl_->CreatePendingTree(); | 1764 host_impl()->CreatePendingTree(); |
| 1948 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | 1765 LayerTreeImpl* pending_tree = host_impl()->pending_tree(); |
| 1949 | 1766 |
| 1950 // Steal from the recycled tree. | 1767 // Steal from the recycled tree. |
| 1951 std::unique_ptr<FakePictureLayerImpl> pending_layer = | 1768 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
| 1952 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, | 1769 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, |
| 1953 pending_raster_source); | 1770 pending_raster_source); |
| 1954 pending_layer->SetDrawsContent(true); | 1771 pending_layer->SetDrawsContent(true); |
| 1955 pending_layer->SetHasRenderSurface(true); | 1772 pending_layer->SetHasRenderSurface(true); |
| 1956 | 1773 |
| 1957 // The bounds() just mirror the raster source size. | 1774 // The bounds() just mirror the raster source size. |
| 1958 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 1775 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
| 1959 pending_tree->SetRootLayer(std::move(pending_layer)); | 1776 pending_tree->SetRootLayer(std::move(pending_layer)); |
| 1960 | 1777 |
| 1961 // Add tilings/tiles for the layer. | 1778 // Add tilings/tiles for the layer. |
| 1962 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 1779 host_impl()->pending_tree()->BuildPropertyTreesForTesting(); |
| 1963 host_impl_->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 1780 host_impl()->pending_tree()->UpdateDrawProperties( |
| 1781 false /* update_lcd_text */); |
| 1964 | 1782 |
| 1965 // Build the raster queue and invalidate the top tile. | 1783 // Build the raster queue and invalidate the top tile. |
| 1966 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_->BuildRasterQueue( | 1784 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 1967 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1785 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
| 1968 EXPECT_FALSE(queue->IsEmpty()); | 1786 EXPECT_FALSE(queue->IsEmpty()); |
| 1969 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); | 1787 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); |
| 1970 | 1788 |
| 1971 // PrepareTiles to schedule tasks. Due to the CancellingTileTaskManager, | 1789 // PrepareTiles to schedule tasks. Due to the CancellingTileTaskManager, |
| 1972 // these tasks will immediately be canceled. | 1790 // these tasks will immediately be canceled. |
| 1973 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); | 1791 host_impl()->tile_manager()->PrepareTiles(host_impl()->global_tile_state()); |
| 1974 | 1792 |
| 1975 // Make sure that the tile we invalidated above was not returned to the pool | 1793 // Make sure that the tile we invalidated above was not returned to the pool |
| 1976 // with its invalidated resource ID. | 1794 // with its invalidated resource ID. |
| 1977 host_impl_->resource_pool()->CheckBusyResources(); | 1795 host_impl()->resource_pool()->CheckBusyResources(); |
| 1978 EXPECT_FALSE(host_impl_->resource_pool()->TryAcquireResourceWithContentId( | 1796 EXPECT_FALSE(host_impl()->resource_pool()->TryAcquireResourceWithContentId( |
| 1979 kInvalidatedId)); | 1797 kInvalidatedId)); |
| 1980 | 1798 |
| 1981 // Free our host_impl_ before the cancelling_task_manager we passed it, as it | 1799 // Free our host_impl_ before the cancelling_task_manager we passed it, as it |
| 1982 // will use that class in clean up. | 1800 // will use that class in clean up. |
| 1983 host_impl_ = nullptr; | 1801 TakeHostImpl(); |
| 1984 } | 1802 } |
| 1985 | 1803 |
| 1986 // FakeRasterBufferProviderImpl that verifies the resource content ID of raster | 1804 // FakeRasterBufferProviderImpl that verifies the resource content ID of raster |
| 1987 // tasks. | 1805 // tasks. |
| 1988 class VerifyResourceContentIdRasterBufferProvider | 1806 class VerifyResourceContentIdRasterBufferProvider |
| 1989 : public FakeRasterBufferProviderImpl { | 1807 : public FakeRasterBufferProviderImpl { |
| 1990 public: | 1808 public: |
| 1991 explicit VerifyResourceContentIdRasterBufferProvider( | 1809 explicit VerifyResourceContentIdRasterBufferProvider( |
| 1992 uint64_t expected_resource_id) | 1810 uint64_t expected_resource_id) |
| 1993 : expected_resource_id_(expected_resource_id) {} | 1811 : expected_resource_id_(expected_resource_id) {} |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 host_impl->tile_manager()->PrepareTiles(host_impl->global_tile_state()); | 1899 host_impl->tile_manager()->PrepareTiles(host_impl->global_tile_state()); |
| 2082 | 1900 |
| 2083 // Free our host_impl before the verifying_task_manager we passed it, as it | 1901 // Free our host_impl before the verifying_task_manager we passed it, as it |
| 2084 // will use that class in clean up. | 1902 // will use that class in clean up. |
| 2085 host_impl = nullptr; | 1903 host_impl = nullptr; |
| 2086 } | 1904 } |
| 2087 | 1905 |
| 2088 // Ensures that the tile manager successfully reuses tiles when partial | 1906 // Ensures that the tile manager successfully reuses tiles when partial |
| 2089 // raster is enabled. | 1907 // raster is enabled. |
| 2090 TEST_F(PartialRasterTileManagerTest, PartialRasterSuccessfullyEnabled) { | 1908 TEST_F(PartialRasterTileManagerTest, PartialRasterSuccessfullyEnabled) { |
| 2091 RunPartialRasterCheck(std::move(host_impl_), | 1909 RunPartialRasterCheck(TakeHostImpl(), true /* partial_raster_enabled */); |
| 2092 true /* partial_raster_enabled */); | |
| 2093 } | 1910 } |
| 2094 | 1911 |
| 2095 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1912 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 2096 // raster is disabled. | 1913 // raster is disabled. |
| 2097 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1914 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 2098 RunPartialRasterCheck(std::move(host_impl_), | 1915 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); |
| 2099 false /* partial_raster_enabled */); | |
| 2100 } | 1916 } |
| 2101 | 1917 |
| 2102 } // namespace | 1918 } // namespace |
| 2103 } // namespace cc | 1919 } // namespace cc |
| OLD | NEW |