| 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" |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 std::set<Tile*> actual_required_for_activation_tiles; | 545 std::set<Tile*> actual_required_for_activation_tiles; |
| 546 while (!queue->IsEmpty()) { | 546 while (!queue->IsEmpty()) { |
| 547 Tile* tile = queue->Top().tile(); | 547 Tile* tile = queue->Top().tile(); |
| 548 queue->Pop(); | 548 queue->Pop(); |
| 549 actual_required_for_activation_tiles.insert(tile); | 549 actual_required_for_activation_tiles.insert(tile); |
| 550 } | 550 } |
| 551 EXPECT_EQ(expected_required_for_activation_tiles, | 551 EXPECT_EQ(expected_required_for_activation_tiles, |
| 552 actual_required_for_activation_tiles); | 552 actual_required_for_activation_tiles); |
| 553 } | 553 } |
| 554 | 554 |
| 555 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { | 555 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeSoon) { |
| 556 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 556 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 557 | 557 |
| 558 gfx::Size layer_bounds(1000, 1000); | 558 gfx::Size layer_bounds(1000, 1000); |
| 559 SetupDefaultTrees(layer_bounds); | 559 SetupDefaultTrees(layer_bounds); |
| 560 | 560 |
| 561 // Create a pending child layer. | 561 // Create a pending child layer. |
| 562 scoped_refptr<FakeRasterSource> pending_raster_source = | 562 scoped_refptr<FakeRasterSource> pending_raster_source = |
| 563 FakeRasterSource::CreateFilled(layer_bounds); | 563 FakeRasterSource::CreateFilled(layer_bounds); |
| 564 std::unique_ptr<FakePictureLayerImpl> pending_child = | 564 std::unique_ptr<FakePictureLayerImpl> pending_child = |
| 565 FakePictureLayerImpl::CreateWithRasterSource( | 565 FakePictureLayerImpl::CreateWithRasterSource( |
| 566 host_impl()->pending_tree(), layer_id() + 1, pending_raster_source); | 566 host_impl()->pending_tree(), layer_id() + 1, pending_raster_source); |
| 567 FakePictureLayerImpl* pending_child_raw = pending_child.get(); | 567 FakePictureLayerImpl* pending_child_raw = pending_child.get(); |
| 568 pending_child_raw->SetDrawsContent(true); | 568 pending_child_raw->SetDrawsContent(true); |
| 569 pending_layer()->test_properties()->AddChild(std::move(pending_child)); | 569 pending_layer()->test_properties()->AddChild(std::move(pending_child)); |
| 570 | 570 |
| 571 // Set a small viewport, so we have soon and eventually tiles. | 571 // Set a small viewport, so we have soon and eventually tiles. |
| 572 host_impl()->SetViewportSize(gfx::Size(200, 200)); | 572 host_impl()->SetViewportSize(gfx::Size(200, 200)); |
| 573 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 573 host_impl()->AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
| 574 bool update_lcd_text = false; | 574 bool update_lcd_text = false; |
| 575 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; | 575 host_impl()->pending_tree()->property_trees()->needs_rebuild = true; |
| 576 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting(); | 576 host_impl()->pending_tree()->BuildLayerListAndPropertyTreesForTesting(); |
| 577 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); | 577 host_impl()->pending_tree()->UpdateDrawProperties(update_lcd_text); |
| 578 | 578 |
| 579 host_impl()->SetRequiresHighResToDraw(); | 579 host_impl()->SetRequiresHighResToDraw(); |
| 580 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( | 580 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl()->BuildRasterQueue( |
| 581 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 581 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
| 582 EXPECT_FALSE(queue->IsEmpty()); | 582 EXPECT_FALSE(queue->IsEmpty()); |
| 583 | 583 |
| 584 // Get all the tiles that are NOW or SOON and make sure they are ready to | 584 // Get all the tiles that are NOW and make sure they are ready to draw. |
| 585 // draw. | |
| 586 std::vector<Tile*> all_tiles; | 585 std::vector<Tile*> all_tiles; |
| 587 while (!queue->IsEmpty()) { | 586 while (!queue->IsEmpty()) { |
| 588 PrioritizedTile prioritized_tile = queue->Top(); | 587 PrioritizedTile prioritized_tile = queue->Top(); |
| 589 if (prioritized_tile.priority().priority_bin >= TilePriority::EVENTUALLY) | 588 if (prioritized_tile.priority().priority_bin >= TilePriority::SOON) |
| 590 break; | 589 break; |
| 591 | 590 |
| 592 all_tiles.push_back(prioritized_tile.tile()); | 591 all_tiles.push_back(prioritized_tile.tile()); |
| 593 queue->Pop(); | 592 queue->Pop(); |
| 594 } | 593 } |
| 595 | 594 |
| 596 tile_manager()->InitializeTilesWithResourcesForTesting( | 595 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 597 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 596 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 598 | 597 |
| 599 // Ensure we can activate. | 598 // Ensure we can activate. |
| (...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 } | 1889 } |
| 1891 | 1890 |
| 1892 // Ensures that the tile manager does not attempt to reuse tiles when partial | 1891 // Ensures that the tile manager does not attempt to reuse tiles when partial |
| 1893 // raster is disabled. | 1892 // raster is disabled. |
| 1894 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 1893 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
| 1895 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); | 1894 RunPartialRasterCheck(TakeHostImpl(), false /* partial_raster_enabled */); |
| 1896 } | 1895 } |
| 1897 | 1896 |
| 1898 } // namespace | 1897 } // namespace |
| 1899 } // namespace cc | 1898 } // namespace cc |
| OLD | NEW |