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 "cc/resources/eviction_tile_priority_queue.h" | 5 #include "cc/resources/eviction_tile_priority_queue.h" |
6 #include "cc/resources/raster_tile_priority_queue.h" | 6 #include "cc/resources/raster_tile_priority_queue.h" |
7 #include "cc/resources/tile.h" | 7 #include "cc/resources/tile.h" |
8 #include "cc/resources/tile_priority.h" | 8 #include "cc/resources/tile_priority.h" |
9 #include "cc/test/begin_frame_args_test.h" | 9 #include "cc/test/begin_frame_args_test.h" |
10 #include "cc/test/fake_impl_proxy.h" | 10 #include "cc/test/fake_impl_proxy.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 FakePictureLayerImpl* pending_layer_; | 143 FakePictureLayerImpl* pending_layer_; |
144 FakePictureLayerImpl* active_layer_; | 144 FakePictureLayerImpl* active_layer_; |
145 }; | 145 }; |
146 | 146 |
147 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { | 147 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { |
148 const gfx::Size layer_bounds(1000, 1000); | 148 const gfx::Size layer_bounds(1000, 1000); |
149 host_impl_.SetViewportSize(layer_bounds); | 149 host_impl_.SetViewportSize(layer_bounds); |
150 SetupDefaultTrees(layer_bounds); | 150 SetupDefaultTrees(layer_bounds); |
151 | 151 |
152 RasterTilePriorityQueue queue; | 152 RasterTilePriorityQueue queue; |
153 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); | 153 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 154 RasterTilePriorityQueue::Type::ALL); |
154 EXPECT_FALSE(queue.IsEmpty()); | 155 EXPECT_FALSE(queue.IsEmpty()); |
155 | 156 |
156 size_t tile_count = 0; | 157 size_t tile_count = 0; |
157 std::set<Tile*> all_tiles; | 158 std::set<Tile*> all_tiles; |
158 while (!queue.IsEmpty()) { | 159 while (!queue.IsEmpty()) { |
159 EXPECT_TRUE(queue.Top()); | 160 EXPECT_TRUE(queue.Top()); |
160 all_tiles.insert(queue.Top()); | 161 all_tiles.insert(queue.Top()); |
161 ++tile_count; | 162 ++tile_count; |
162 queue.Pop(); | 163 queue.Pop(); |
163 } | 164 } |
164 | 165 |
165 EXPECT_EQ(tile_count, all_tiles.size()); | 166 EXPECT_EQ(tile_count, all_tiles.size()); |
166 EXPECT_EQ(16u, tile_count); | 167 EXPECT_EQ(16u, tile_count); |
167 | 168 |
168 // Sanity check, all tiles should be visible. | 169 // Sanity check, all tiles should be visible. |
169 std::set<Tile*> smoothness_tiles; | 170 std::set<Tile*> smoothness_tiles; |
170 queue.Reset(); | 171 queue.Reset(); |
171 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 172 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY, |
| 173 RasterTilePriorityQueue::Type::ALL); |
172 bool had_low_res = false; | 174 bool had_low_res = false; |
173 while (!queue.IsEmpty()) { | 175 while (!queue.IsEmpty()) { |
174 Tile* tile = queue.Top(); | 176 Tile* tile = queue.Top(); |
175 EXPECT_TRUE(tile); | 177 EXPECT_TRUE(tile); |
176 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); | 178 EXPECT_EQ(TilePriority::NOW, tile->priority(ACTIVE_TREE).priority_bin); |
177 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); | 179 EXPECT_EQ(TilePriority::NOW, tile->priority(PENDING_TREE).priority_bin); |
178 if (tile->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) | 180 if (tile->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) |
179 had_low_res = true; | 181 had_low_res = true; |
180 else | 182 else |
181 smoothness_tiles.insert(tile); | 183 smoothness_tiles.insert(tile); |
182 queue.Pop(); | 184 queue.Pop(); |
183 } | 185 } |
184 EXPECT_EQ(all_tiles, smoothness_tiles); | 186 EXPECT_EQ(all_tiles, smoothness_tiles); |
185 EXPECT_TRUE(had_low_res); | 187 EXPECT_TRUE(had_low_res); |
186 | 188 |
| 189 // Check that everything is required for activation. |
| 190 queue.Reset(); |
| 191 host_impl_.BuildRasterQueue( |
| 192 &queue, SMOOTHNESS_TAKES_PRIORITY, |
| 193 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 194 std::set<Tile*> required_for_activation_tiles; |
| 195 while (!queue.IsEmpty()) { |
| 196 Tile* tile = queue.Top(); |
| 197 EXPECT_TRUE(tile->required_for_activation()); |
| 198 required_for_activation_tiles.insert(tile); |
| 199 queue.Pop(); |
| 200 } |
| 201 EXPECT_EQ(all_tiles, required_for_activation_tiles); |
| 202 |
| 203 // Check that everything is required for draw. |
| 204 queue.Reset(); |
| 205 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY, |
| 206 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 207 std::set<Tile*> required_for_draw_tiles; |
| 208 while (!queue.IsEmpty()) { |
| 209 Tile* tile = queue.Top(); |
| 210 EXPECT_TRUE(tile->required_for_draw()); |
| 211 required_for_draw_tiles.insert(tile); |
| 212 queue.Pop(); |
| 213 } |
| 214 EXPECT_EQ(all_tiles, required_for_draw_tiles); |
| 215 |
187 Region invalidation(gfx::Rect(0, 0, 500, 500)); | 216 Region invalidation(gfx::Rect(0, 0, 500, 500)); |
188 | 217 |
189 // Invalidate the pending tree. | 218 // Invalidate the pending tree. |
190 pending_layer_->set_invalidation(invalidation); | 219 pending_layer_->set_invalidation(invalidation); |
191 pending_layer_->HighResTiling()->Invalidate(invalidation); | 220 pending_layer_->HighResTiling()->Invalidate(invalidation); |
192 pending_layer_->LowResTiling()->Invalidate(invalidation); | 221 pending_layer_->LowResTiling()->Invalidate(invalidation); |
193 | 222 |
194 active_layer_->ResetAllTilesPriorities(); | 223 active_layer_->ResetAllTilesPriorities(); |
195 pending_layer_->ResetAllTilesPriorities(); | 224 pending_layer_->ResetAllTilesPriorities(); |
196 | 225 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 active_layer_->LowResTiling()->AllTilesForTesting(); | 260 active_layer_->LowResTiling()->AllTilesForTesting(); |
232 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) | 261 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) |
233 all_tiles.insert(active_low_res_tiles[i]); | 262 all_tiles.insert(active_low_res_tiles[i]); |
234 | 263 |
235 Tile* last_tile = NULL; | 264 Tile* last_tile = NULL; |
236 smoothness_tiles.clear(); | 265 smoothness_tiles.clear(); |
237 tile_count = 0; | 266 tile_count = 0; |
238 size_t correct_order_tiles = 0u; | 267 size_t correct_order_tiles = 0u; |
239 // Here we expect to get increasing ACTIVE_TREE priority_bin. | 268 // Here we expect to get increasing ACTIVE_TREE priority_bin. |
240 queue.Reset(); | 269 queue.Reset(); |
241 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 270 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY, |
| 271 RasterTilePriorityQueue::Type::ALL); |
| 272 std::set<Tile*> actual_required_for_draw_tiles; |
| 273 std::set<Tile*> actual_required_for_activation_tiles; |
242 while (!queue.IsEmpty()) { | 274 while (!queue.IsEmpty()) { |
243 Tile* tile = queue.Top(); | 275 Tile* tile = queue.Top(); |
244 EXPECT_TRUE(tile); | 276 EXPECT_TRUE(tile); |
245 | 277 |
246 if (!last_tile) | 278 if (!last_tile) |
247 last_tile = tile; | 279 last_tile = tile; |
248 | 280 |
249 EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, | 281 EXPECT_LE(last_tile->priority(ACTIVE_TREE).priority_bin, |
250 tile->priority(ACTIVE_TREE).priority_bin); | 282 tile->priority(ACTIVE_TREE).priority_bin); |
251 bool skip_updating_last_tile = false; | 283 bool skip_updating_last_tile = false; |
(...skipping 15 matching lines...) Expand all Loading... |
267 last_tile->priority(ACTIVE_TREE).resolution != | 299 last_tile->priority(ACTIVE_TREE).resolution != |
268 tile->priority(ACTIVE_TREE).resolution) { | 300 tile->priority(ACTIVE_TREE).resolution) { |
269 // Low resolution should come first. | 301 // Low resolution should come first. |
270 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); | 302 EXPECT_EQ(LOW_RESOLUTION, last_tile->priority(ACTIVE_TREE).resolution); |
271 } | 303 } |
272 | 304 |
273 if (!skip_updating_last_tile) | 305 if (!skip_updating_last_tile) |
274 last_tile = tile; | 306 last_tile = tile; |
275 ++tile_count; | 307 ++tile_count; |
276 smoothness_tiles.insert(tile); | 308 smoothness_tiles.insert(tile); |
| 309 if (tile->required_for_draw()) |
| 310 actual_required_for_draw_tiles.insert(tile); |
| 311 if (tile->required_for_activation()) |
| 312 actual_required_for_activation_tiles.insert(tile); |
277 queue.Pop(); | 313 queue.Pop(); |
278 } | 314 } |
279 | 315 |
280 EXPECT_EQ(tile_count, smoothness_tiles.size()); | 316 EXPECT_EQ(tile_count, smoothness_tiles.size()); |
281 EXPECT_EQ(all_tiles, smoothness_tiles); | 317 EXPECT_EQ(all_tiles, smoothness_tiles); |
282 // Since we don't guarantee increasing distance due to spiral iterator, we | 318 // Since we don't guarantee increasing distance due to spiral iterator, we |
283 // should check that we're _mostly_ right. | 319 // should check that we're _mostly_ right. |
284 EXPECT_GT(correct_order_tiles, 3 * tile_count / 4); | 320 EXPECT_GT(correct_order_tiles, 3 * tile_count / 4); |
285 | 321 |
| 322 // Check that we have consistent required_for_activation tiles. |
| 323 queue.Reset(); |
| 324 host_impl_.BuildRasterQueue( |
| 325 &queue, SMOOTHNESS_TAKES_PRIORITY, |
| 326 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 327 required_for_activation_tiles.clear(); |
| 328 while (!queue.IsEmpty()) { |
| 329 Tile* tile = queue.Top(); |
| 330 EXPECT_TRUE(tile->required_for_activation()); |
| 331 required_for_activation_tiles.insert(tile); |
| 332 queue.Pop(); |
| 333 } |
| 334 EXPECT_EQ(actual_required_for_activation_tiles, |
| 335 required_for_activation_tiles); |
| 336 |
| 337 // Check that we have consistent required_for_draw tiles. |
| 338 queue.Reset(); |
| 339 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY, |
| 340 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 341 required_for_draw_tiles.clear(); |
| 342 while (!queue.IsEmpty()) { |
| 343 Tile* tile = queue.Top(); |
| 344 EXPECT_TRUE(tile->required_for_draw()); |
| 345 required_for_draw_tiles.insert(tile); |
| 346 queue.Pop(); |
| 347 } |
| 348 EXPECT_EQ(actual_required_for_draw_tiles, required_for_draw_tiles); |
| 349 |
286 std::set<Tile*> new_content_tiles; | 350 std::set<Tile*> new_content_tiles; |
287 last_tile = NULL; | 351 last_tile = NULL; |
288 size_t increasing_distance_tiles = 0u; | 352 size_t increasing_distance_tiles = 0u; |
289 // Here we expect to get increasing PENDING_TREE priority_bin. | 353 // Here we expect to get increasing PENDING_TREE priority_bin. |
290 queue.Reset(); | 354 queue.Reset(); |
291 host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); | 355 host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY, |
| 356 RasterTilePriorityQueue::Type::ALL); |
292 tile_count = 0; | 357 tile_count = 0; |
293 while (!queue.IsEmpty()) { | 358 while (!queue.IsEmpty()) { |
294 Tile* tile = queue.Top(); | 359 Tile* tile = queue.Top(); |
295 EXPECT_TRUE(tile); | 360 EXPECT_TRUE(tile); |
296 | 361 |
297 if (!last_tile) | 362 if (!last_tile) |
298 last_tile = tile; | 363 last_tile = tile; |
299 | 364 |
300 EXPECT_LE(last_tile->priority(PENDING_TREE).priority_bin, | 365 EXPECT_LE(last_tile->priority(PENDING_TREE).priority_bin, |
301 tile->priority(PENDING_TREE).priority_bin); | 366 tile->priority(PENDING_TREE).priority_bin); |
(...skipping 15 matching lines...) Expand all Loading... |
317 new_content_tiles.insert(tile); | 382 new_content_tiles.insert(tile); |
318 ++tile_count; | 383 ++tile_count; |
319 queue.Pop(); | 384 queue.Pop(); |
320 } | 385 } |
321 | 386 |
322 EXPECT_EQ(tile_count, new_content_tiles.size()); | 387 EXPECT_EQ(tile_count, new_content_tiles.size()); |
323 EXPECT_EQ(high_res_tiles, new_content_tiles); | 388 EXPECT_EQ(high_res_tiles, new_content_tiles); |
324 // Since we don't guarantee increasing distance due to spiral iterator, we | 389 // Since we don't guarantee increasing distance due to spiral iterator, we |
325 // should check that we're _mostly_ right. | 390 // should check that we're _mostly_ right. |
326 EXPECT_GE(increasing_distance_tiles, 3 * tile_count / 4); | 391 EXPECT_GE(increasing_distance_tiles, 3 * tile_count / 4); |
| 392 |
| 393 // Check that we have consistent required_for_activation tiles. |
| 394 queue.Reset(); |
| 395 host_impl_.BuildRasterQueue( |
| 396 &queue, NEW_CONTENT_TAKES_PRIORITY, |
| 397 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION); |
| 398 required_for_activation_tiles.clear(); |
| 399 while (!queue.IsEmpty()) { |
| 400 Tile* tile = queue.Top(); |
| 401 EXPECT_TRUE(tile->required_for_activation()); |
| 402 required_for_activation_tiles.insert(tile); |
| 403 queue.Pop(); |
| 404 } |
| 405 EXPECT_EQ(actual_required_for_activation_tiles, |
| 406 required_for_activation_tiles); |
| 407 |
| 408 // Check that we have consistent required_for_draw tiles. |
| 409 queue.Reset(); |
| 410 host_impl_.BuildRasterQueue(&queue, NEW_CONTENT_TAKES_PRIORITY, |
| 411 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW); |
| 412 required_for_draw_tiles.clear(); |
| 413 while (!queue.IsEmpty()) { |
| 414 Tile* tile = queue.Top(); |
| 415 EXPECT_TRUE(tile->required_for_draw()); |
| 416 required_for_draw_tiles.insert(tile); |
| 417 queue.Pop(); |
| 418 } |
| 419 EXPECT_EQ(actual_required_for_draw_tiles, required_for_draw_tiles); |
327 } | 420 } |
328 | 421 |
329 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { | 422 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { |
330 base::TimeTicks time_ticks; | 423 base::TimeTicks time_ticks; |
331 time_ticks += base::TimeDelta::FromMilliseconds(1); | 424 time_ticks += base::TimeDelta::FromMilliseconds(1); |
332 host_impl_.SetCurrentBeginFrameArgs( | 425 host_impl_.SetCurrentBeginFrameArgs( |
333 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 426 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
334 | 427 |
335 gfx::Size layer_bounds(1000, 1000); | 428 gfx::Size layer_bounds(1000, 1000); |
336 SetupDefaultTrees(layer_bounds); | 429 SetupDefaultTrees(layer_bounds); |
(...skipping 11 matching lines...) Expand all Loading... |
348 | 441 |
349 // Set a small viewport, so we have soon and eventually tiles. | 442 // Set a small viewport, so we have soon and eventually tiles. |
350 host_impl_.SetViewportSize(gfx::Size(200, 200)); | 443 host_impl_.SetViewportSize(gfx::Size(200, 200)); |
351 time_ticks += base::TimeDelta::FromMilliseconds(1); | 444 time_ticks += base::TimeDelta::FromMilliseconds(1); |
352 host_impl_.SetCurrentBeginFrameArgs( | 445 host_impl_.SetCurrentBeginFrameArgs( |
353 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 446 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
354 host_impl_.pending_tree()->UpdateDrawProperties(); | 447 host_impl_.pending_tree()->UpdateDrawProperties(); |
355 | 448 |
356 RasterTilePriorityQueue queue; | 449 RasterTilePriorityQueue queue; |
357 host_impl_.SetRequiresHighResToDraw(); | 450 host_impl_.SetRequiresHighResToDraw(); |
358 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 451 host_impl_.BuildRasterQueue(&queue, SMOOTHNESS_TAKES_PRIORITY, |
| 452 RasterTilePriorityQueue::Type::ALL); |
359 EXPECT_FALSE(queue.IsEmpty()); | 453 EXPECT_FALSE(queue.IsEmpty()); |
360 | 454 |
361 // Get all the tiles that are NOW or SOON and make sure they are ready to | 455 // Get all the tiles that are NOW or SOON and make sure they are ready to |
362 // draw. | 456 // draw. |
363 std::vector<Tile*> all_tiles; | 457 std::vector<Tile*> all_tiles; |
364 while (!queue.IsEmpty()) { | 458 while (!queue.IsEmpty()) { |
365 Tile* tile = queue.Top(); | 459 Tile* tile = queue.Top(); |
366 if (tile->combined_priority().priority_bin >= TilePriority::EVENTUALLY) | 460 if (tile->combined_priority().priority_bin >= TilePriority::EVENTUALLY) |
367 break; | 461 break; |
368 | 462 |
(...skipping 14 matching lines...) Expand all Loading... |
383 host_impl_.SetViewportSize(layer_bounds); | 477 host_impl_.SetViewportSize(layer_bounds); |
384 SetupDefaultTrees(layer_bounds); | 478 SetupDefaultTrees(layer_bounds); |
385 | 479 |
386 EvictionTilePriorityQueue empty_queue; | 480 EvictionTilePriorityQueue empty_queue; |
387 host_impl_.BuildEvictionQueue(&empty_queue, SAME_PRIORITY_FOR_BOTH_TREES); | 481 host_impl_.BuildEvictionQueue(&empty_queue, SAME_PRIORITY_FOR_BOTH_TREES); |
388 EXPECT_TRUE(empty_queue.IsEmpty()); | 482 EXPECT_TRUE(empty_queue.IsEmpty()); |
389 std::set<Tile*> all_tiles; | 483 std::set<Tile*> all_tiles; |
390 size_t tile_count = 0; | 484 size_t tile_count = 0; |
391 | 485 |
392 RasterTilePriorityQueue raster_queue; | 486 RasterTilePriorityQueue raster_queue; |
393 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES); | 487 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 488 RasterTilePriorityQueue::Type::ALL); |
394 while (!raster_queue.IsEmpty()) { | 489 while (!raster_queue.IsEmpty()) { |
395 ++tile_count; | 490 ++tile_count; |
396 EXPECT_TRUE(raster_queue.Top()); | 491 EXPECT_TRUE(raster_queue.Top()); |
397 all_tiles.insert(raster_queue.Top()); | 492 all_tiles.insert(raster_queue.Top()); |
398 raster_queue.Pop(); | 493 raster_queue.Pop(); |
399 } | 494 } |
400 | 495 |
401 EXPECT_EQ(tile_count, all_tiles.size()); | 496 EXPECT_EQ(tile_count, all_tiles.size()); |
402 EXPECT_EQ(16u, tile_count); | 497 EXPECT_EQ(16u, tile_count); |
403 | 498 |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 pending_child_layer->SetDrawsContent(true); | 675 pending_child_layer->SetDrawsContent(true); |
581 | 676 |
582 time_ticks += base::TimeDelta::FromMilliseconds(1); | 677 time_ticks += base::TimeDelta::FromMilliseconds(1); |
583 host_impl_.SetCurrentBeginFrameArgs( | 678 host_impl_.SetCurrentBeginFrameArgs( |
584 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); | 679 CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, time_ticks)); |
585 host_impl_.pending_tree()->UpdateDrawProperties(); | 680 host_impl_.pending_tree()->UpdateDrawProperties(); |
586 | 681 |
587 std::set<Tile*> all_tiles; | 682 std::set<Tile*> all_tiles; |
588 size_t tile_count = 0; | 683 size_t tile_count = 0; |
589 RasterTilePriorityQueue raster_queue; | 684 RasterTilePriorityQueue raster_queue; |
590 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES); | 685 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 686 RasterTilePriorityQueue::Type::ALL); |
591 while (!raster_queue.IsEmpty()) { | 687 while (!raster_queue.IsEmpty()) { |
592 ++tile_count; | 688 ++tile_count; |
593 EXPECT_TRUE(raster_queue.Top()); | 689 EXPECT_TRUE(raster_queue.Top()); |
594 all_tiles.insert(raster_queue.Top()); | 690 all_tiles.insert(raster_queue.Top()); |
595 raster_queue.Pop(); | 691 raster_queue.Pop(); |
596 } | 692 } |
597 EXPECT_EQ(tile_count, all_tiles.size()); | 693 EXPECT_EQ(tile_count, all_tiles.size()); |
598 EXPECT_EQ(32u, tile_count); | 694 EXPECT_EQ(32u, tile_count); |
599 | 695 |
600 pending_layer_->ResetAllTilesPriorities(); | 696 pending_layer_->ResetAllTilesPriorities(); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 EXPECT_EQ(tile_count, new_content_tiles.size()); | 881 EXPECT_EQ(tile_count, new_content_tiles.size()); |
786 EXPECT_EQ(all_tiles, new_content_tiles); | 882 EXPECT_EQ(all_tiles, new_content_tiles); |
787 } | 883 } |
788 | 884 |
789 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { | 885 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { |
790 const gfx::Size layer_bounds(1000, 1000); | 886 const gfx::Size layer_bounds(1000, 1000); |
791 host_impl_.SetViewportSize(layer_bounds); | 887 host_impl_.SetViewportSize(layer_bounds); |
792 SetupDefaultTrees(layer_bounds); | 888 SetupDefaultTrees(layer_bounds); |
793 | 889 |
794 RasterTilePriorityQueue queue; | 890 RasterTilePriorityQueue queue; |
795 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); | 891 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 892 RasterTilePriorityQueue::Type::ALL); |
796 EXPECT_FALSE(queue.IsEmpty()); | 893 EXPECT_FALSE(queue.IsEmpty()); |
797 | 894 |
798 size_t tile_count = 0; | 895 size_t tile_count = 0; |
799 std::set<Tile*> all_tiles; | 896 std::set<Tile*> all_tiles; |
800 while (!queue.IsEmpty()) { | 897 while (!queue.IsEmpty()) { |
801 EXPECT_TRUE(queue.Top()); | 898 EXPECT_TRUE(queue.Top()); |
802 all_tiles.insert(queue.Top()); | 899 all_tiles.insert(queue.Top()); |
803 ++tile_count; | 900 ++tile_count; |
804 queue.Pop(); | 901 queue.Pop(); |
805 } | 902 } |
806 | 903 |
807 EXPECT_EQ(tile_count, all_tiles.size()); | 904 EXPECT_EQ(tile_count, all_tiles.size()); |
808 EXPECT_EQ(16u, tile_count); | 905 EXPECT_EQ(16u, tile_count); |
809 | 906 |
810 queue.Reset(); | 907 queue.Reset(); |
811 for (int i = 1; i < 10; ++i) { | 908 for (int i = 1; i < 10; ++i) { |
812 scoped_ptr<FakePictureLayerImpl> pending_layer = | 909 scoped_ptr<FakePictureLayerImpl> pending_layer = |
813 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); | 910 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); |
814 pending_layer->SetDrawsContent(true); | 911 pending_layer->SetDrawsContent(true); |
815 pending_layer->set_has_valid_tile_priorities(true); | 912 pending_layer->set_has_valid_tile_priorities(true); |
816 pending_layer_->AddChild(pending_layer.Pass()); | 913 pending_layer_->AddChild(pending_layer.Pass()); |
817 } | 914 } |
818 | 915 |
819 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES); | 916 host_impl_.BuildRasterQueue(&queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 917 RasterTilePriorityQueue::Type::ALL); |
820 EXPECT_FALSE(queue.IsEmpty()); | 918 EXPECT_FALSE(queue.IsEmpty()); |
821 | 919 |
822 tile_count = 0; | 920 tile_count = 0; |
823 all_tiles.clear(); | 921 all_tiles.clear(); |
824 while (!queue.IsEmpty()) { | 922 while (!queue.IsEmpty()) { |
825 EXPECT_TRUE(queue.Top()); | 923 EXPECT_TRUE(queue.Top()); |
826 all_tiles.insert(queue.Top()); | 924 all_tiles.insert(queue.Top()); |
827 ++tile_count; | 925 ++tile_count; |
828 queue.Pop(); | 926 queue.Pop(); |
829 } | 927 } |
830 EXPECT_EQ(tile_count, all_tiles.size()); | 928 EXPECT_EQ(tile_count, all_tiles.size()); |
831 EXPECT_EQ(16u, tile_count); | 929 EXPECT_EQ(16u, tile_count); |
832 } | 930 } |
833 | 931 |
834 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { | 932 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { |
835 const gfx::Size layer_bounds(1000, 1000); | 933 const gfx::Size layer_bounds(1000, 1000); |
836 host_impl_.SetViewportSize(layer_bounds); | 934 host_impl_.SetViewportSize(layer_bounds); |
837 SetupDefaultTrees(layer_bounds); | 935 SetupDefaultTrees(layer_bounds); |
838 | 936 |
839 RasterTilePriorityQueue raster_queue; | 937 RasterTilePriorityQueue raster_queue; |
840 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES); | 938 host_impl_.BuildRasterQueue(&raster_queue, SAME_PRIORITY_FOR_BOTH_TREES, |
| 939 RasterTilePriorityQueue::Type::ALL); |
841 EXPECT_FALSE(raster_queue.IsEmpty()); | 940 EXPECT_FALSE(raster_queue.IsEmpty()); |
842 | 941 |
843 size_t tile_count = 0; | 942 size_t tile_count = 0; |
844 std::set<Tile*> all_tiles; | 943 std::set<Tile*> all_tiles; |
845 while (!raster_queue.IsEmpty()) { | 944 while (!raster_queue.IsEmpty()) { |
846 EXPECT_TRUE(raster_queue.Top()); | 945 EXPECT_TRUE(raster_queue.Top()); |
847 all_tiles.insert(raster_queue.Top()); | 946 all_tiles.insert(raster_queue.Top()); |
848 ++tile_count; | 947 ++tile_count; |
849 raster_queue.Pop(); | 948 raster_queue.Pop(); |
850 } | 949 } |
(...skipping 22 matching lines...) Expand all Loading... |
873 all_tiles.insert(queue.Top()); | 972 all_tiles.insert(queue.Top()); |
874 ++tile_count; | 973 ++tile_count; |
875 queue.Pop(); | 974 queue.Pop(); |
876 } | 975 } |
877 EXPECT_EQ(tile_count, all_tiles.size()); | 976 EXPECT_EQ(tile_count, all_tiles.size()); |
878 EXPECT_EQ(16u, tile_count); | 977 EXPECT_EQ(16u, tile_count); |
879 } | 978 } |
880 | 979 |
881 } // namespace | 980 } // namespace |
882 } // namespace cc | 981 } // namespace cc |
OLD | NEW |