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/run_loop.h" | 9 #include "base/run_loop.h" |
9 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
10 #include "cc/playback/raster_source.h" | 11 #include "cc/playback/raster_source.h" |
11 #include "cc/playback/recording_source.h" | 12 #include "cc/playback/recording_source.h" |
12 #include "cc/raster/raster_buffer.h" | 13 #include "cc/raster/raster_buffer.h" |
13 #include "cc/resources/resource_pool.h" | 14 #include "cc/resources/resource_pool.h" |
14 #include "cc/test/begin_frame_args_test.h" | 15 #include "cc/test/begin_frame_args_test.h" |
15 #include "cc/test/fake_impl_task_runner_provider.h" | 16 #include "cc/test/fake_impl_task_runner_provider.h" |
16 #include "cc/test/fake_layer_tree_host_impl.h" | 17 #include "cc/test/fake_layer_tree_host_impl.h" |
17 #include "cc/test/fake_output_surface.h" | 18 #include "cc/test/fake_output_surface.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 // Steal from the recycled tree. | 129 // Steal from the recycled tree. |
129 LayerImpl* old_pending_root = pending_tree->root_layer(); | 130 LayerImpl* old_pending_root = pending_tree->root_layer(); |
130 DCHECK(!old_pending_root || old_pending_root->id() == id_); | 131 DCHECK(!old_pending_root || old_pending_root->id() == id_); |
131 | 132 |
132 FakePictureLayerImpl* pending_layer = nullptr; | 133 FakePictureLayerImpl* pending_layer = nullptr; |
133 if (old_pending_root) { | 134 if (old_pending_root) { |
134 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); | 135 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); |
135 pending_layer->SetRasterSourceOnPending(raster_source, Region()); | 136 pending_layer->SetRasterSourceOnPending(raster_source, Region()); |
136 } else { | 137 } else { |
137 scoped_ptr<FakePictureLayerImpl> new_root = | 138 std::unique_ptr<FakePictureLayerImpl> new_root = |
138 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, | 139 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id_, |
139 raster_source); | 140 raster_source); |
140 pending_layer = new_root.get(); | 141 pending_layer = new_root.get(); |
141 pending_tree->SetRootLayer(std::move(new_root)); | 142 pending_tree->SetRootLayer(std::move(new_root)); |
142 pending_layer->SetDrawsContent(true); | 143 pending_layer->SetDrawsContent(true); |
143 pending_layer->SetHasRenderSurface(true); | 144 pending_layer->SetHasRenderSurface(true); |
144 } | 145 } |
145 // The bounds() just mirror the raster source size. | 146 // The bounds() just mirror the raster source size. |
146 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 147 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
147 | 148 |
(...skipping 12 matching lines...) Expand all Loading... |
160 GlobalStateThatImpactsTilePriority global_state_; | 161 GlobalStateThatImpactsTilePriority global_state_; |
161 | 162 |
162 TestSharedBitmapManager shared_bitmap_manager_; | 163 TestSharedBitmapManager shared_bitmap_manager_; |
163 TestTaskGraphRunner task_graph_runner_; | 164 TestTaskGraphRunner task_graph_runner_; |
164 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; | 165 TestGpuMemoryBufferManager gpu_memory_buffer_manager_; |
165 TileMemoryLimitPolicy memory_limit_policy_; | 166 TileMemoryLimitPolicy memory_limit_policy_; |
166 int max_tiles_; | 167 int max_tiles_; |
167 bool ready_to_activate_; | 168 bool ready_to_activate_; |
168 int id_; | 169 int id_; |
169 FakeImplTaskRunnerProvider task_runner_provider_; | 170 FakeImplTaskRunnerProvider task_runner_provider_; |
170 scoped_ptr<OutputSurface> output_surface_; | 171 std::unique_ptr<OutputSurface> output_surface_; |
171 FakeLayerTreeHostImpl host_impl_; | 172 FakeLayerTreeHostImpl host_impl_; |
172 FakePictureLayerImpl* pending_layer_; | 173 FakePictureLayerImpl* pending_layer_; |
173 FakePictureLayerImpl* active_layer_; | 174 FakePictureLayerImpl* active_layer_; |
174 }; | 175 }; |
175 | 176 |
176 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { | 177 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueue) { |
177 const gfx::Size layer_bounds(1000, 1000); | 178 const gfx::Size layer_bounds(1000, 1000); |
178 host_impl_.SetViewportSize(layer_bounds); | 179 host_impl_.SetViewportSize(layer_bounds); |
179 SetupDefaultTrees(layer_bounds); | 180 SetupDefaultTrees(layer_bounds); |
180 | 181 |
181 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 182 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
182 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 183 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
183 EXPECT_FALSE(queue->IsEmpty()); | 184 EXPECT_FALSE(queue->IsEmpty()); |
184 | 185 |
185 size_t tile_count = 0; | 186 size_t tile_count = 0; |
186 std::set<Tile*> all_tiles; | 187 std::set<Tile*> all_tiles; |
187 while (!queue->IsEmpty()) { | 188 while (!queue->IsEmpty()) { |
188 EXPECT_TRUE(queue->Top().tile()); | 189 EXPECT_TRUE(queue->Top().tile()); |
189 all_tiles.insert(queue->Top().tile()); | 190 all_tiles.insert(queue->Top().tile()); |
190 ++tile_count; | 191 ++tile_count; |
191 queue->Pop(); | 192 queue->Pop(); |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 if (tiling->contents_scale() == 1.f) { | 473 if (tiling->contents_scale() == 1.f) { |
473 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 474 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
474 const auto& all_tiles = tiling->AllTilesForTesting(); | 475 const auto& all_tiles = tiling->AllTilesForTesting(); |
475 for (auto* tile : all_tiles) | 476 for (auto* tile : all_tiles) |
476 EXPECT_TRUE(tile->required_for_activation()); | 477 EXPECT_TRUE(tile->required_for_activation()); |
477 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 478 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
478 } | 479 } |
479 } | 480 } |
480 } | 481 } |
481 | 482 |
482 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 483 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
483 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 484 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
484 EXPECT_FALSE(queue->IsEmpty()); | 485 EXPECT_FALSE(queue->IsEmpty()); |
485 | 486 |
486 size_t tile_count = 0; | 487 size_t tile_count = 0; |
487 std::set<Tile*> all_actual_tiles; | 488 std::set<Tile*> all_actual_tiles; |
488 while (!queue->IsEmpty()) { | 489 while (!queue->IsEmpty()) { |
489 EXPECT_TRUE(queue->Top().tile()); | 490 EXPECT_TRUE(queue->Top().tile()); |
490 all_actual_tiles.insert(queue->Top().tile()); | 491 all_actual_tiles.insert(queue->Top().tile()); |
491 ++tile_count; | 492 ++tile_count; |
492 queue->Pop(); | 493 queue->Pop(); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 if (tiling->contents_scale() == 1.f) { | 540 if (tiling->contents_scale() == 1.f) { |
540 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); | 541 tiling->UpdateAndGetAllPrioritizedTilesForTesting(); |
541 const auto& all_tiles = tiling->AllTilesForTesting(); | 542 const auto& all_tiles = tiling->AllTilesForTesting(); |
542 for (auto* tile : all_tiles) | 543 for (auto* tile : all_tiles) |
543 EXPECT_TRUE(tile->required_for_activation()); | 544 EXPECT_TRUE(tile->required_for_activation()); |
544 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); | 545 all_expected_tiles.insert(all_tiles.begin(), all_tiles.end()); |
545 } | 546 } |
546 } | 547 } |
547 } | 548 } |
548 | 549 |
549 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 550 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
550 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 551 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
551 EXPECT_FALSE(queue->IsEmpty()); | 552 EXPECT_FALSE(queue->IsEmpty()); |
552 | 553 |
553 size_t tile_count = 0; | 554 size_t tile_count = 0; |
554 std::set<Tile*> all_actual_tiles; | 555 std::set<Tile*> all_actual_tiles; |
555 while (!queue->IsEmpty()) { | 556 while (!queue->IsEmpty()) { |
556 EXPECT_TRUE(queue->Top().tile()); | 557 EXPECT_TRUE(queue->Top().tile()); |
557 all_actual_tiles.insert(queue->Top().tile()); | 558 all_actual_tiles.insert(queue->Top().tile()); |
558 ++tile_count; | 559 ++tile_count; |
559 queue->Pop(); | 560 queue->Pop(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 pending_layer_->HighResTiling()->TileAt(i, j)); | 626 pending_layer_->HighResTiling()->TileAt(i, j)); |
626 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(i, j)); | 627 EXPECT_TRUE(active_layer_->HighResTiling()->TileAt(i, j)); |
627 expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); | 628 expected_all_tiles.insert(active_layer_->HighResTiling()->TileAt(i, j)); |
628 } | 629 } |
629 } | 630 } |
630 // Expect 15 shared tiles and 1 unshared tile. | 631 // Expect 15 shared tiles and 1 unshared tile. |
631 EXPECT_EQ(17u, expected_all_tiles.size()); | 632 EXPECT_EQ(17u, expected_all_tiles.size()); |
632 | 633 |
633 // The actual test will now build different queues and verify that the queues | 634 // The actual test will now build different queues and verify that the queues |
634 // return the same information as computed manually above. | 635 // return the same information as computed manually above. |
635 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 636 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
636 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 637 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
637 std::set<Tile*> actual_now_tiles; | 638 std::set<Tile*> actual_now_tiles; |
638 std::set<Tile*> actual_all_tiles; | 639 std::set<Tile*> actual_all_tiles; |
639 while (!queue->IsEmpty()) { | 640 while (!queue->IsEmpty()) { |
640 PrioritizedTile prioritized_tile = queue->Top(); | 641 PrioritizedTile prioritized_tile = queue->Top(); |
641 queue->Pop(); | 642 queue->Pop(); |
642 if (prioritized_tile.priority().priority_bin == TilePriority::NOW) | 643 if (prioritized_tile.priority().priority_bin == TilePriority::NOW) |
643 actual_now_tiles.insert(prioritized_tile.tile()); | 644 actual_now_tiles.insert(prioritized_tile.tile()); |
644 actual_all_tiles.insert(prioritized_tile.tile()); | 645 actual_all_tiles.insert(prioritized_tile.tile()); |
645 } | 646 } |
(...skipping 26 matching lines...) Expand all Loading... |
672 | 673 |
673 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { | 674 TEST_F(TileManagerTilePriorityQueueTest, ActivationComesBeforeEventually) { |
674 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 675 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
675 | 676 |
676 gfx::Size layer_bounds(1000, 1000); | 677 gfx::Size layer_bounds(1000, 1000); |
677 SetupDefaultTrees(layer_bounds); | 678 SetupDefaultTrees(layer_bounds); |
678 | 679 |
679 // Create a pending child layer. | 680 // Create a pending child layer. |
680 scoped_refptr<FakeRasterSource> pending_raster_source = | 681 scoped_refptr<FakeRasterSource> pending_raster_source = |
681 FakeRasterSource::CreateFilled(layer_bounds); | 682 FakeRasterSource::CreateFilled(layer_bounds); |
682 scoped_ptr<FakePictureLayerImpl> pending_child = | 683 std::unique_ptr<FakePictureLayerImpl> pending_child = |
683 FakePictureLayerImpl::CreateWithRasterSource( | 684 FakePictureLayerImpl::CreateWithRasterSource( |
684 host_impl_.pending_tree(), id_ + 1, pending_raster_source); | 685 host_impl_.pending_tree(), id_ + 1, pending_raster_source); |
685 FakePictureLayerImpl* pending_child_raw = pending_child.get(); | 686 FakePictureLayerImpl* pending_child_raw = pending_child.get(); |
686 pending_child_raw->SetDrawsContent(true); | 687 pending_child_raw->SetDrawsContent(true); |
687 pending_layer_->AddChild(std::move(pending_child)); | 688 pending_layer_->AddChild(std::move(pending_child)); |
688 | 689 |
689 // Set a small viewport, so we have soon and eventually tiles. | 690 // Set a small viewport, so we have soon and eventually tiles. |
690 host_impl_.SetViewportSize(gfx::Size(200, 200)); | 691 host_impl_.SetViewportSize(gfx::Size(200, 200)); |
691 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 692 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
692 bool update_lcd_text = false; | 693 bool update_lcd_text = false; |
693 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; | 694 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; |
694 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | 695 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); |
695 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 696 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
696 | 697 |
697 host_impl_.SetRequiresHighResToDraw(); | 698 host_impl_.SetRequiresHighResToDraw(); |
698 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 699 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
699 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); | 700 SMOOTHNESS_TAKES_PRIORITY, RasterTilePriorityQueue::Type::ALL)); |
700 EXPECT_FALSE(queue->IsEmpty()); | 701 EXPECT_FALSE(queue->IsEmpty()); |
701 | 702 |
702 // Get all the tiles that are NOW or SOON and make sure they are ready to | 703 // Get all the tiles that are NOW or SOON and make sure they are ready to |
703 // draw. | 704 // draw. |
704 std::vector<Tile*> all_tiles; | 705 std::vector<Tile*> all_tiles; |
705 while (!queue->IsEmpty()) { | 706 while (!queue->IsEmpty()) { |
706 PrioritizedTile prioritized_tile = queue->Top(); | 707 PrioritizedTile prioritized_tile = queue->Top(); |
707 if (prioritized_tile.priority().priority_bin >= TilePriority::EVENTUALLY) | 708 if (prioritized_tile.priority().priority_bin >= TilePriority::EVENTUALLY) |
708 break; | 709 break; |
(...skipping 11 matching lines...) Expand all Loading... |
720 | 721 |
721 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { | 722 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueue) { |
722 const gfx::Size layer_bounds(1000, 1000); | 723 const gfx::Size layer_bounds(1000, 1000); |
723 host_impl_.SetViewportSize(layer_bounds); | 724 host_impl_.SetViewportSize(layer_bounds); |
724 SetupDefaultTrees(layer_bounds); | 725 SetupDefaultTrees(layer_bounds); |
725 ASSERT_TRUE(active_layer_->HighResTiling()); | 726 ASSERT_TRUE(active_layer_->HighResTiling()); |
726 ASSERT_TRUE(active_layer_->LowResTiling()); | 727 ASSERT_TRUE(active_layer_->LowResTiling()); |
727 ASSERT_TRUE(pending_layer_->HighResTiling()); | 728 ASSERT_TRUE(pending_layer_->HighResTiling()); |
728 EXPECT_FALSE(pending_layer_->LowResTiling()); | 729 EXPECT_FALSE(pending_layer_->LowResTiling()); |
729 | 730 |
730 scoped_ptr<EvictionTilePriorityQueue> empty_queue( | 731 std::unique_ptr<EvictionTilePriorityQueue> empty_queue( |
731 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); | 732 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); |
732 EXPECT_TRUE(empty_queue->IsEmpty()); | 733 EXPECT_TRUE(empty_queue->IsEmpty()); |
733 std::set<Tile*> all_tiles; | 734 std::set<Tile*> all_tiles; |
734 size_t tile_count = 0; | 735 size_t tile_count = 0; |
735 | 736 |
736 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue( | 737 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
737 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 738 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 739 RasterTilePriorityQueue::Type::ALL)); |
738 while (!raster_queue->IsEmpty()) { | 740 while (!raster_queue->IsEmpty()) { |
739 ++tile_count; | 741 ++tile_count; |
740 EXPECT_TRUE(raster_queue->Top().tile()); | 742 EXPECT_TRUE(raster_queue->Top().tile()); |
741 all_tiles.insert(raster_queue->Top().tile()); | 743 all_tiles.insert(raster_queue->Top().tile()); |
742 raster_queue->Pop(); | 744 raster_queue->Pop(); |
743 } | 745 } |
744 | 746 |
745 EXPECT_EQ(tile_count, all_tiles.size()); | 747 EXPECT_EQ(tile_count, all_tiles.size()); |
746 EXPECT_EQ(16u, tile_count); | 748 EXPECT_EQ(16u, tile_count); |
747 | 749 |
748 tile_manager()->InitializeTilesWithResourcesForTesting( | 750 tile_manager()->InitializeTilesWithResourcesForTesting( |
749 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 751 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
750 | 752 |
751 scoped_ptr<EvictionTilePriorityQueue> queue( | 753 std::unique_ptr<EvictionTilePriorityQueue> queue( |
752 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); | 754 host_impl_.BuildEvictionQueue(SMOOTHNESS_TAKES_PRIORITY)); |
753 EXPECT_FALSE(queue->IsEmpty()); | 755 EXPECT_FALSE(queue->IsEmpty()); |
754 | 756 |
755 // Sanity check, all tiles should be visible. | 757 // Sanity check, all tiles should be visible. |
756 std::set<Tile*> smoothness_tiles; | 758 std::set<Tile*> smoothness_tiles; |
757 while (!queue->IsEmpty()) { | 759 while (!queue->IsEmpty()) { |
758 PrioritizedTile prioritized_tile = queue->Top(); | 760 PrioritizedTile prioritized_tile = queue->Top(); |
759 EXPECT_TRUE(prioritized_tile.tile()); | 761 EXPECT_TRUE(prioritized_tile.tile()); |
760 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); | 762 EXPECT_EQ(TilePriority::NOW, prioritized_tile.priority().priority_bin); |
761 EXPECT_TRUE(prioritized_tile.tile()->draw_info().has_resource()); | 763 EXPECT_TRUE(prioritized_tile.tile()->draw_info().has_resource()); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 897 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
896 | 898 |
897 gfx::Size layer_bounds(1000, 1000); | 899 gfx::Size layer_bounds(1000, 1000); |
898 | 900 |
899 host_impl_.SetViewportSize(layer_bounds); | 901 host_impl_.SetViewportSize(layer_bounds); |
900 | 902 |
901 scoped_refptr<FakeRasterSource> pending_raster_source = | 903 scoped_refptr<FakeRasterSource> pending_raster_source = |
902 FakeRasterSource::CreateFilled(layer_bounds); | 904 FakeRasterSource::CreateFilled(layer_bounds); |
903 SetupPendingTree(pending_raster_source); | 905 SetupPendingTree(pending_raster_source); |
904 | 906 |
905 scoped_ptr<FakePictureLayerImpl> pending_child = | 907 std::unique_ptr<FakePictureLayerImpl> pending_child = |
906 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, | 908 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, |
907 pending_raster_source); | 909 pending_raster_source); |
908 pending_layer_->AddChild(std::move(pending_child)); | 910 pending_layer_->AddChild(std::move(pending_child)); |
909 | 911 |
910 FakePictureLayerImpl* pending_child_layer = | 912 FakePictureLayerImpl* pending_child_layer = |
911 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); | 913 static_cast<FakePictureLayerImpl*>(pending_layer_->children()[0]); |
912 pending_child_layer->SetDrawsContent(true); | 914 pending_child_layer->SetDrawsContent(true); |
913 | 915 |
914 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 916 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
915 bool update_lcd_text = false; | 917 bool update_lcd_text = false; |
916 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; | 918 host_impl_.pending_tree()->property_trees()->needs_rebuild = true; |
917 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); | 919 host_impl_.pending_tree()->BuildPropertyTreesForTesting(); |
918 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); | 920 host_impl_.pending_tree()->UpdateDrawProperties(update_lcd_text); |
919 | 921 |
920 ActivateTree(); | 922 ActivateTree(); |
921 SetupPendingTree(pending_raster_source); | 923 SetupPendingTree(pending_raster_source); |
922 | 924 |
923 FakePictureLayerImpl* active_child_layer = | 925 FakePictureLayerImpl* active_child_layer = |
924 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]); | 926 static_cast<FakePictureLayerImpl*>(active_layer_->children()[0]); |
925 | 927 |
926 std::set<Tile*> all_tiles; | 928 std::set<Tile*> all_tiles; |
927 size_t tile_count = 0; | 929 size_t tile_count = 0; |
928 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue( | 930 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
929 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 931 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 932 RasterTilePriorityQueue::Type::ALL)); |
930 while (!raster_queue->IsEmpty()) { | 933 while (!raster_queue->IsEmpty()) { |
931 ++tile_count; | 934 ++tile_count; |
932 EXPECT_TRUE(raster_queue->Top().tile()); | 935 EXPECT_TRUE(raster_queue->Top().tile()); |
933 all_tiles.insert(raster_queue->Top().tile()); | 936 all_tiles.insert(raster_queue->Top().tile()); |
934 raster_queue->Pop(); | 937 raster_queue->Pop(); |
935 } | 938 } |
936 EXPECT_EQ(tile_count, all_tiles.size()); | 939 EXPECT_EQ(tile_count, all_tiles.size()); |
937 EXPECT_EQ(32u, tile_count); | 940 EXPECT_EQ(32u, tile_count); |
938 | 941 |
939 // Renew all of the tile priorities. | 942 // Renew all of the tile priorities. |
(...skipping 26 matching lines...) Expand all Loading... |
966 active_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); | 969 active_child_layer->HighResTiling()->SetAllTilesOccludedForTesting(); |
967 active_child_layer->LowResTiling()->SetAllTilesOccludedForTesting(); | 970 active_child_layer->LowResTiling()->SetAllTilesOccludedForTesting(); |
968 | 971 |
969 tile_manager()->InitializeTilesWithResourcesForTesting( | 972 tile_manager()->InitializeTilesWithResourcesForTesting( |
970 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 973 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
971 | 974 |
972 // Verify occlusion is considered by EvictionTilePriorityQueue. | 975 // Verify occlusion is considered by EvictionTilePriorityQueue. |
973 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 976 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
974 size_t occluded_count = 0u; | 977 size_t occluded_count = 0u; |
975 PrioritizedTile last_tile; | 978 PrioritizedTile last_tile; |
976 scoped_ptr<EvictionTilePriorityQueue> queue( | 979 std::unique_ptr<EvictionTilePriorityQueue> queue( |
977 host_impl_.BuildEvictionQueue(tree_priority)); | 980 host_impl_.BuildEvictionQueue(tree_priority)); |
978 while (!queue->IsEmpty()) { | 981 while (!queue->IsEmpty()) { |
979 PrioritizedTile prioritized_tile = queue->Top(); | 982 PrioritizedTile prioritized_tile = queue->Top(); |
980 if (!last_tile.tile()) | 983 if (!last_tile.tile()) |
981 last_tile = prioritized_tile; | 984 last_tile = prioritized_tile; |
982 | 985 |
983 bool tile_is_occluded = prioritized_tile.is_occluded(); | 986 bool tile_is_occluded = prioritized_tile.is_occluded(); |
984 | 987 |
985 // The only way we will encounter an occluded tile after an unoccluded | 988 // The only way we will encounter an occluded tile after an unoccluded |
986 // tile is if the priorty bin decreased, the tile is required for | 989 // tile is if the priorty bin decreased, the tile is required for |
(...skipping 24 matching lines...) Expand all Loading... |
1011 TEST_F(TileManagerTilePriorityQueueTest, | 1014 TEST_F(TileManagerTilePriorityQueueTest, |
1012 EvictionTilePriorityQueueWithTransparentLayer) { | 1015 EvictionTilePriorityQueueWithTransparentLayer) { |
1013 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); | 1016 host_impl_.AdvanceToNextFrame(base::TimeDelta::FromMilliseconds(1)); |
1014 | 1017 |
1015 gfx::Size layer_bounds(1000, 1000); | 1018 gfx::Size layer_bounds(1000, 1000); |
1016 | 1019 |
1017 scoped_refptr<FakeRasterSource> pending_raster_source = | 1020 scoped_refptr<FakeRasterSource> pending_raster_source = |
1018 FakeRasterSource::CreateFilled(layer_bounds); | 1021 FakeRasterSource::CreateFilled(layer_bounds); |
1019 SetupPendingTree(pending_raster_source); | 1022 SetupPendingTree(pending_raster_source); |
1020 | 1023 |
1021 scoped_ptr<FakePictureLayerImpl> pending_child = | 1024 std::unique_ptr<FakePictureLayerImpl> pending_child = |
1022 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, | 1025 FakePictureLayerImpl::CreateWithRasterSource(host_impl_.pending_tree(), 2, |
1023 pending_raster_source); | 1026 pending_raster_source); |
1024 FakePictureLayerImpl* pending_child_layer = pending_child.get(); | 1027 FakePictureLayerImpl* pending_child_layer = pending_child.get(); |
1025 pending_layer_->AddChild(std::move(pending_child)); | 1028 pending_layer_->AddChild(std::move(pending_child)); |
1026 | 1029 |
1027 // Create a fully transparent child layer so that its tile priorities are not | 1030 // Create a fully transparent child layer so that its tile priorities are not |
1028 // considered to be valid. | 1031 // considered to be valid. |
1029 pending_child_layer->SetDrawsContent(true); | 1032 pending_child_layer->SetDrawsContent(true); |
1030 pending_child_layer->SetForceRenderSurface(true); | 1033 pending_child_layer->SetForceRenderSurface(true); |
1031 | 1034 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 | 1074 |
1072 EXPECT_TRUE(pending_layer_->HasValidTilePriorities()); | 1075 EXPECT_TRUE(pending_layer_->HasValidTilePriorities()); |
1073 EXPECT_FALSE(pending_child_layer->HasValidTilePriorities()); | 1076 EXPECT_FALSE(pending_child_layer->HasValidTilePriorities()); |
1074 | 1077 |
1075 // Verify that eviction queue returns tiles also from layers without valid | 1078 // Verify that eviction queue returns tiles also from layers without valid |
1076 // tile priorities and that the tile priority bin of those tiles is (at most) | 1079 // tile priorities and that the tile priority bin of those tiles is (at most) |
1077 // EVENTUALLY. | 1080 // EVENTUALLY. |
1078 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; | 1081 TreePriority tree_priority = NEW_CONTENT_TAKES_PRIORITY; |
1079 std::set<Tile*> new_content_tiles; | 1082 std::set<Tile*> new_content_tiles; |
1080 size_t tile_count = 0; | 1083 size_t tile_count = 0; |
1081 scoped_ptr<EvictionTilePriorityQueue> queue( | 1084 std::unique_ptr<EvictionTilePriorityQueue> queue( |
1082 host_impl_.BuildEvictionQueue(tree_priority)); | 1085 host_impl_.BuildEvictionQueue(tree_priority)); |
1083 while (!queue->IsEmpty()) { | 1086 while (!queue->IsEmpty()) { |
1084 PrioritizedTile prioritized_tile = queue->Top(); | 1087 PrioritizedTile prioritized_tile = queue->Top(); |
1085 Tile* tile = prioritized_tile.tile(); | 1088 Tile* tile = prioritized_tile.tile(); |
1086 const TilePriority& pending_priority = prioritized_tile.priority(); | 1089 const TilePriority& pending_priority = prioritized_tile.priority(); |
1087 EXPECT_NE(std::numeric_limits<float>::infinity(), | 1090 EXPECT_NE(std::numeric_limits<float>::infinity(), |
1088 pending_priority.distance_to_visible); | 1091 pending_priority.distance_to_visible); |
1089 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) | 1092 if (all_pending_child_tiles.find(tile) != all_pending_child_tiles.end()) |
1090 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); | 1093 EXPECT_EQ(TilePriority::EVENTUALLY, pending_priority.priority_bin); |
1091 else | 1094 else |
1092 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); | 1095 EXPECT_EQ(TilePriority::NOW, pending_priority.priority_bin); |
1093 new_content_tiles.insert(tile); | 1096 new_content_tiles.insert(tile); |
1094 ++tile_count; | 1097 ++tile_count; |
1095 queue->Pop(); | 1098 queue->Pop(); |
1096 } | 1099 } |
1097 EXPECT_EQ(tile_count, new_content_tiles.size()); | 1100 EXPECT_EQ(tile_count, new_content_tiles.size()); |
1098 EXPECT_EQ(all_tiles, new_content_tiles); | 1101 EXPECT_EQ(all_tiles, new_content_tiles); |
1099 } | 1102 } |
1100 | 1103 |
1101 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { | 1104 TEST_F(TileManagerTilePriorityQueueTest, RasterTilePriorityQueueEmptyLayers) { |
1102 const gfx::Size layer_bounds(1000, 1000); | 1105 const gfx::Size layer_bounds(1000, 1000); |
1103 host_impl_.SetViewportSize(layer_bounds); | 1106 host_impl_.SetViewportSize(layer_bounds); |
1104 SetupDefaultTrees(layer_bounds); | 1107 SetupDefaultTrees(layer_bounds); |
1105 | 1108 |
1106 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1109 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
1107 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1110 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
1108 EXPECT_FALSE(queue->IsEmpty()); | 1111 EXPECT_FALSE(queue->IsEmpty()); |
1109 | 1112 |
1110 size_t tile_count = 0; | 1113 size_t tile_count = 0; |
1111 std::set<Tile*> all_tiles; | 1114 std::set<Tile*> all_tiles; |
1112 while (!queue->IsEmpty()) { | 1115 while (!queue->IsEmpty()) { |
1113 EXPECT_TRUE(queue->Top().tile()); | 1116 EXPECT_TRUE(queue->Top().tile()); |
1114 all_tiles.insert(queue->Top().tile()); | 1117 all_tiles.insert(queue->Top().tile()); |
1115 ++tile_count; | 1118 ++tile_count; |
1116 queue->Pop(); | 1119 queue->Pop(); |
1117 } | 1120 } |
1118 | 1121 |
1119 EXPECT_EQ(tile_count, all_tiles.size()); | 1122 EXPECT_EQ(tile_count, all_tiles.size()); |
1120 EXPECT_EQ(16u, tile_count); | 1123 EXPECT_EQ(16u, tile_count); |
1121 | 1124 |
1122 for (int i = 1; i < 10; ++i) { | 1125 for (int i = 1; i < 10; ++i) { |
1123 scoped_ptr<FakePictureLayerImpl> pending_layer = | 1126 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
1124 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); | 1127 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); |
1125 pending_layer->SetDrawsContent(true); | 1128 pending_layer->SetDrawsContent(true); |
1126 pending_layer->set_has_valid_tile_priorities(true); | 1129 pending_layer->set_has_valid_tile_priorities(true); |
1127 pending_layer_->AddChild(std::move(pending_layer)); | 1130 pending_layer_->AddChild(std::move(pending_layer)); |
1128 } | 1131 } |
1129 | 1132 |
1130 queue = host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, | 1133 queue = host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
1131 RasterTilePriorityQueue::Type::ALL); | 1134 RasterTilePriorityQueue::Type::ALL); |
1132 EXPECT_FALSE(queue->IsEmpty()); | 1135 EXPECT_FALSE(queue->IsEmpty()); |
1133 | 1136 |
1134 tile_count = 0; | 1137 tile_count = 0; |
1135 all_tiles.clear(); | 1138 all_tiles.clear(); |
1136 while (!queue->IsEmpty()) { | 1139 while (!queue->IsEmpty()) { |
1137 EXPECT_TRUE(queue->Top().tile()); | 1140 EXPECT_TRUE(queue->Top().tile()); |
1138 all_tiles.insert(queue->Top().tile()); | 1141 all_tiles.insert(queue->Top().tile()); |
1139 ++tile_count; | 1142 ++tile_count; |
1140 queue->Pop(); | 1143 queue->Pop(); |
1141 } | 1144 } |
1142 EXPECT_EQ(tile_count, all_tiles.size()); | 1145 EXPECT_EQ(tile_count, all_tiles.size()); |
1143 EXPECT_EQ(16u, tile_count); | 1146 EXPECT_EQ(16u, tile_count); |
1144 } | 1147 } |
1145 | 1148 |
1146 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { | 1149 TEST_F(TileManagerTilePriorityQueueTest, EvictionTilePriorityQueueEmptyLayers) { |
1147 const gfx::Size layer_bounds(1000, 1000); | 1150 const gfx::Size layer_bounds(1000, 1000); |
1148 host_impl_.SetViewportSize(layer_bounds); | 1151 host_impl_.SetViewportSize(layer_bounds); |
1149 SetupDefaultTrees(layer_bounds); | 1152 SetupDefaultTrees(layer_bounds); |
1150 | 1153 |
1151 scoped_ptr<RasterTilePriorityQueue> raster_queue(host_impl_.BuildRasterQueue( | 1154 std::unique_ptr<RasterTilePriorityQueue> raster_queue( |
1152 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1155 host_impl_.BuildRasterQueue(SAME_PRIORITY_FOR_BOTH_TREES, |
| 1156 RasterTilePriorityQueue::Type::ALL)); |
1153 EXPECT_FALSE(raster_queue->IsEmpty()); | 1157 EXPECT_FALSE(raster_queue->IsEmpty()); |
1154 | 1158 |
1155 size_t tile_count = 0; | 1159 size_t tile_count = 0; |
1156 std::set<Tile*> all_tiles; | 1160 std::set<Tile*> all_tiles; |
1157 while (!raster_queue->IsEmpty()) { | 1161 while (!raster_queue->IsEmpty()) { |
1158 EXPECT_TRUE(raster_queue->Top().tile()); | 1162 EXPECT_TRUE(raster_queue->Top().tile()); |
1159 all_tiles.insert(raster_queue->Top().tile()); | 1163 all_tiles.insert(raster_queue->Top().tile()); |
1160 ++tile_count; | 1164 ++tile_count; |
1161 raster_queue->Pop(); | 1165 raster_queue->Pop(); |
1162 } | 1166 } |
1163 EXPECT_EQ(tile_count, all_tiles.size()); | 1167 EXPECT_EQ(tile_count, all_tiles.size()); |
1164 EXPECT_EQ(16u, tile_count); | 1168 EXPECT_EQ(16u, tile_count); |
1165 | 1169 |
1166 std::vector<Tile*> tiles(all_tiles.begin(), all_tiles.end()); | 1170 std::vector<Tile*> tiles(all_tiles.begin(), all_tiles.end()); |
1167 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); | 1171 host_impl_.tile_manager()->InitializeTilesWithResourcesForTesting(tiles); |
1168 | 1172 |
1169 for (int i = 1; i < 10; ++i) { | 1173 for (int i = 1; i < 10; ++i) { |
1170 scoped_ptr<FakePictureLayerImpl> pending_layer = | 1174 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
1171 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); | 1175 FakePictureLayerImpl::Create(host_impl_.pending_tree(), id_ + i); |
1172 pending_layer->SetDrawsContent(true); | 1176 pending_layer->SetDrawsContent(true); |
1173 pending_layer->set_has_valid_tile_priorities(true); | 1177 pending_layer->set_has_valid_tile_priorities(true); |
1174 pending_layer_->AddChild(std::move(pending_layer)); | 1178 pending_layer_->AddChild(std::move(pending_layer)); |
1175 } | 1179 } |
1176 | 1180 |
1177 scoped_ptr<EvictionTilePriorityQueue> queue( | 1181 std::unique_ptr<EvictionTilePriorityQueue> queue( |
1178 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); | 1182 host_impl_.BuildEvictionQueue(SAME_PRIORITY_FOR_BOTH_TREES)); |
1179 EXPECT_FALSE(queue->IsEmpty()); | 1183 EXPECT_FALSE(queue->IsEmpty()); |
1180 | 1184 |
1181 tile_count = 0; | 1185 tile_count = 0; |
1182 all_tiles.clear(); | 1186 all_tiles.clear(); |
1183 while (!queue->IsEmpty()) { | 1187 while (!queue->IsEmpty()) { |
1184 EXPECT_TRUE(queue->Top().tile()); | 1188 EXPECT_TRUE(queue->Top().tile()); |
1185 all_tiles.insert(queue->Top().tile()); | 1189 all_tiles.insert(queue->Top().tile()); |
1186 ++tile_count; | 1190 ++tile_count; |
1187 queue->Pop(); | 1191 queue->Pop(); |
1188 } | 1192 } |
1189 EXPECT_EQ(tile_count, all_tiles.size()); | 1193 EXPECT_EQ(tile_count, all_tiles.size()); |
1190 EXPECT_EQ(16u, tile_count); | 1194 EXPECT_EQ(16u, tile_count); |
1191 } | 1195 } |
1192 | 1196 |
1193 TEST_F(TileManagerTilePriorityQueueTest, | 1197 TEST_F(TileManagerTilePriorityQueueTest, |
1194 RasterTilePriorityQueueStaticViewport) { | 1198 RasterTilePriorityQueueStaticViewport) { |
1195 FakePictureLayerTilingClient client; | 1199 FakePictureLayerTilingClient client; |
1196 | 1200 |
1197 gfx::Rect viewport(50, 50, 500, 500); | 1201 gfx::Rect viewport(50, 50, 500, 500); |
1198 gfx::Size layer_bounds(1600, 1600); | 1202 gfx::Size layer_bounds(1600, 1600); |
1199 | 1203 |
1200 float inset = PictureLayerTiling::CalculateSoonBorderDistance(viewport, 1.0f); | 1204 float inset = PictureLayerTiling::CalculateSoonBorderDistance(viewport, 1.0f); |
1201 gfx::Rect soon_rect = viewport; | 1205 gfx::Rect soon_rect = viewport; |
1202 soon_rect.Inset(-inset, -inset); | 1206 soon_rect.Inset(-inset, -inset); |
1203 | 1207 |
1204 client.SetTileSize(gfx::Size(30, 30)); | 1208 client.SetTileSize(gfx::Size(30, 30)); |
1205 LayerTreeSettings settings; | 1209 LayerTreeSettings settings; |
1206 | 1210 |
1207 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( | 1211 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
1208 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1212 PictureLayerTilingSet::Create( |
1209 settings.skewport_target_time_in_seconds, | 1213 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
1210 settings.skewport_extrapolation_limit_in_content_pixels); | 1214 settings.skewport_target_time_in_seconds, |
| 1215 settings.skewport_extrapolation_limit_in_content_pixels); |
1211 | 1216 |
1212 scoped_refptr<FakeRasterSource> raster_source = | 1217 scoped_refptr<FakeRasterSource> raster_source = |
1213 FakeRasterSource::CreateFilled(layer_bounds); | 1218 FakeRasterSource::CreateFilled(layer_bounds); |
1214 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1219 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
1215 tiling->set_resolution(HIGH_RESOLUTION); | 1220 tiling->set_resolution(HIGH_RESOLUTION); |
1216 | 1221 |
1217 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); | 1222 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); |
1218 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); | 1223 std::vector<Tile*> all_tiles = tiling->AllTilesForTesting(); |
1219 // Sanity check. | 1224 // Sanity check. |
1220 EXPECT_EQ(3364u, all_tiles.size()); | 1225 EXPECT_EQ(3364u, all_tiles.size()); |
1221 | 1226 |
1222 // The explanation of each iteration is as follows: | 1227 // The explanation of each iteration is as follows: |
1223 // 1. First iteration tests that we can get all of the tiles correctly. | 1228 // 1. First iteration tests that we can get all of the tiles correctly. |
1224 // 2. Second iteration ensures that we can get all of the tiles again (first | 1229 // 2. Second iteration ensures that we can get all of the tiles again (first |
1225 // iteration didn't change any tiles), as well set all tiles to be ready to | 1230 // iteration didn't change any tiles), as well set all tiles to be ready to |
1226 // draw. | 1231 // draw. |
1227 // 3. Third iteration ensures that no tiles are returned, since they were all | 1232 // 3. Third iteration ensures that no tiles are returned, since they were all |
1228 // marked as ready to draw. | 1233 // marked as ready to draw. |
1229 for (int i = 0; i < 3; ++i) { | 1234 for (int i = 0; i < 3; ++i) { |
1230 scoped_ptr<TilingSetRasterQueueAll> queue( | 1235 std::unique_ptr<TilingSetRasterQueueAll> queue( |
1231 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1236 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1232 | 1237 |
1233 // There are 3 bins in TilePriority. | 1238 // There are 3 bins in TilePriority. |
1234 bool have_tiles[3] = {}; | 1239 bool have_tiles[3] = {}; |
1235 | 1240 |
1236 // On the third iteration, we should get no tiles since everything was | 1241 // On the third iteration, we should get no tiles since everything was |
1237 // marked as ready to draw. | 1242 // marked as ready to draw. |
1238 if (i == 2) { | 1243 if (i == 2) { |
1239 EXPECT_TRUE(queue->IsEmpty()); | 1244 EXPECT_TRUE(queue->IsEmpty()); |
1240 continue; | 1245 continue; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1306 RasterTilePriorityQueueMovingViewport) { | 1311 RasterTilePriorityQueueMovingViewport) { |
1307 FakePictureLayerTilingClient client; | 1312 FakePictureLayerTilingClient client; |
1308 | 1313 |
1309 gfx::Rect viewport(50, 0, 100, 100); | 1314 gfx::Rect viewport(50, 0, 100, 100); |
1310 gfx::Rect moved_viewport(50, 0, 100, 500); | 1315 gfx::Rect moved_viewport(50, 0, 100, 500); |
1311 gfx::Size layer_bounds(1000, 1000); | 1316 gfx::Size layer_bounds(1000, 1000); |
1312 | 1317 |
1313 client.SetTileSize(gfx::Size(30, 30)); | 1318 client.SetTileSize(gfx::Size(30, 30)); |
1314 LayerTreeSettings settings; | 1319 LayerTreeSettings settings; |
1315 | 1320 |
1316 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( | 1321 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
1317 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, | 1322 PictureLayerTilingSet::Create( |
1318 settings.skewport_target_time_in_seconds, | 1323 ACTIVE_TREE, &client, settings.tiling_interest_area_padding, |
1319 settings.skewport_extrapolation_limit_in_content_pixels); | 1324 settings.skewport_target_time_in_seconds, |
| 1325 settings.skewport_extrapolation_limit_in_content_pixels); |
1320 | 1326 |
1321 scoped_refptr<FakeRasterSource> raster_source = | 1327 scoped_refptr<FakeRasterSource> raster_source = |
1322 FakeRasterSource::CreateFilled(layer_bounds); | 1328 FakeRasterSource::CreateFilled(layer_bounds); |
1323 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1329 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
1324 tiling->set_resolution(HIGH_RESOLUTION); | 1330 tiling->set_resolution(HIGH_RESOLUTION); |
1325 | 1331 |
1326 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); | 1332 tiling_set->UpdateTilePriorities(viewport, 1.0f, 1.0, Occlusion(), true); |
1327 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(), | 1333 tiling_set->UpdateTilePriorities(moved_viewport, 1.0f, 2.0, Occlusion(), |
1328 true); | 1334 true); |
1329 | 1335 |
1330 float inset = | 1336 float inset = |
1331 PictureLayerTiling::CalculateSoonBorderDistance(moved_viewport, 1.0f); | 1337 PictureLayerTiling::CalculateSoonBorderDistance(moved_viewport, 1.0f); |
1332 gfx::Rect soon_rect = moved_viewport; | 1338 gfx::Rect soon_rect = moved_viewport; |
1333 soon_rect.Inset(-inset, -inset); | 1339 soon_rect.Inset(-inset, -inset); |
1334 | 1340 |
1335 // There are 3 bins in TilePriority. | 1341 // There are 3 bins in TilePriority. |
1336 bool have_tiles[3] = {}; | 1342 bool have_tiles[3] = {}; |
1337 PrioritizedTile last_tile; | 1343 PrioritizedTile last_tile; |
1338 int eventually_bin_order_correct_count = 0; | 1344 int eventually_bin_order_correct_count = 0; |
1339 int eventually_bin_order_incorrect_count = 0; | 1345 int eventually_bin_order_incorrect_count = 0; |
1340 scoped_ptr<TilingSetRasterQueueAll> queue( | 1346 std::unique_ptr<TilingSetRasterQueueAll> queue( |
1341 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1347 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1342 for (; !queue->IsEmpty(); queue->Pop()) { | 1348 for (; !queue->IsEmpty(); queue->Pop()) { |
1343 if (!last_tile.tile()) | 1349 if (!last_tile.tile()) |
1344 last_tile = queue->Top(); | 1350 last_tile = queue->Top(); |
1345 | 1351 |
1346 const PrioritizedTile& new_tile = queue->Top(); | 1352 const PrioritizedTile& new_tile = queue->Top(); |
1347 | 1353 |
1348 TilePriority last_priority = last_tile.priority(); | 1354 TilePriority last_priority = last_tile.priority(); |
1349 TilePriority new_priority = new_tile.priority(); | 1355 TilePriority new_priority = new_tile.priority(); |
1350 | 1356 |
(...skipping 24 matching lines...) Expand all Loading... |
1375 EXPECT_TRUE(have_tiles[TilePriority::SOON]); | 1381 EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
1376 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); | 1382 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); |
1377 } | 1383 } |
1378 | 1384 |
1379 TEST_F(TileManagerTilePriorityQueueTest, SetIsLikelyToRequireADraw) { | 1385 TEST_F(TileManagerTilePriorityQueueTest, SetIsLikelyToRequireADraw) { |
1380 const gfx::Size layer_bounds(1000, 1000); | 1386 const gfx::Size layer_bounds(1000, 1000); |
1381 host_impl_.SetViewportSize(layer_bounds); | 1387 host_impl_.SetViewportSize(layer_bounds); |
1382 SetupDefaultTrees(layer_bounds); | 1388 SetupDefaultTrees(layer_bounds); |
1383 | 1389 |
1384 // Verify that the queue has a required for draw tile at Top. | 1390 // Verify that the queue has a required for draw tile at Top. |
1385 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1391 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
1386 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1392 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
1387 EXPECT_FALSE(queue->IsEmpty()); | 1393 EXPECT_FALSE(queue->IsEmpty()); |
1388 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1394 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
1389 | 1395 |
1390 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1396 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); |
1391 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1397 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); |
1392 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw()); | 1398 EXPECT_TRUE(host_impl_.is_likely_to_require_a_draw()); |
1393 } | 1399 } |
1394 | 1400 |
1395 TEST_F(TileManagerTilePriorityQueueTest, | 1401 TEST_F(TileManagerTilePriorityQueueTest, |
1396 SetIsLikelyToRequireADrawOnZeroMemoryBudget) { | 1402 SetIsLikelyToRequireADrawOnZeroMemoryBudget) { |
1397 const gfx::Size layer_bounds(1000, 1000); | 1403 const gfx::Size layer_bounds(1000, 1000); |
1398 host_impl_.SetViewportSize(layer_bounds); | 1404 host_impl_.SetViewportSize(layer_bounds); |
1399 SetupDefaultTrees(layer_bounds); | 1405 SetupDefaultTrees(layer_bounds); |
1400 | 1406 |
1401 // Verify that the queue has a required for draw tile at Top. | 1407 // Verify that the queue has a required for draw tile at Top. |
1402 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1408 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
1403 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1409 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
1404 EXPECT_FALSE(queue->IsEmpty()); | 1410 EXPECT_FALSE(queue->IsEmpty()); |
1405 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1411 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
1406 | 1412 |
1407 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); | 1413 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); |
1408 policy.bytes_limit_when_visible = 0; | 1414 policy.bytes_limit_when_visible = 0; |
1409 host_impl_.SetMemoryPolicy(policy); | 1415 host_impl_.SetMemoryPolicy(policy); |
1410 | 1416 |
1411 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1417 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); |
1412 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); | 1418 host_impl_.tile_manager()->PrepareTiles(host_impl_.global_tile_state()); |
1413 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); | 1419 EXPECT_FALSE(host_impl_.is_likely_to_require_a_draw()); |
1414 } | 1420 } |
1415 | 1421 |
1416 TEST_F(TileManagerTilePriorityQueueTest, | 1422 TEST_F(TileManagerTilePriorityQueueTest, |
1417 SetIsLikelyToRequireADrawOnLimitedMemoryBudget) { | 1423 SetIsLikelyToRequireADrawOnLimitedMemoryBudget) { |
1418 const gfx::Size layer_bounds(1000, 1000); | 1424 const gfx::Size layer_bounds(1000, 1000); |
1419 host_impl_.SetViewportSize(layer_bounds); | 1425 host_impl_.SetViewportSize(layer_bounds); |
1420 SetupDefaultTrees(layer_bounds); | 1426 SetupDefaultTrees(layer_bounds); |
1421 | 1427 |
1422 // Verify that the queue has a required for draw tile at Top. | 1428 // Verify that the queue has a required for draw tile at Top. |
1423 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( | 1429 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_.BuildRasterQueue( |
1424 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1430 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
1425 EXPECT_FALSE(queue->IsEmpty()); | 1431 EXPECT_FALSE(queue->IsEmpty()); |
1426 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); | 1432 EXPECT_TRUE(queue->Top().tile()->required_for_draw()); |
1427 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size()); | 1433 EXPECT_EQ(gfx::Size(256, 256), queue->Top().tile()->desired_texture_size()); |
1428 EXPECT_EQ(RGBA_8888, host_impl_.resource_provider()->best_texture_format()); | 1434 EXPECT_EQ(RGBA_8888, host_impl_.resource_provider()->best_texture_format()); |
1429 | 1435 |
1430 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); | 1436 ManagedMemoryPolicy policy = host_impl_.ActualManagedMemoryPolicy(); |
1431 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>( | 1437 policy.bytes_limit_when_visible = ResourceUtil::UncheckedSizeInBytes<size_t>( |
1432 gfx::Size(256, 256), RGBA_8888); | 1438 gfx::Size(256, 256), RGBA_8888); |
1433 host_impl_.SetMemoryPolicy(policy); | 1439 host_impl_.SetMemoryPolicy(policy); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1465 // Verify that we use the real tile bounds when advancing phases during the | 1471 // Verify that we use the real tile bounds when advancing phases during the |
1466 // tile iteration. | 1472 // tile iteration. |
1467 gfx::Size layer_bounds(1, 1); | 1473 gfx::Size layer_bounds(1, 1); |
1468 | 1474 |
1469 scoped_refptr<FakeRasterSource> raster_source = | 1475 scoped_refptr<FakeRasterSource> raster_source = |
1470 FakeRasterSource::CreateFilled(layer_bounds); | 1476 FakeRasterSource::CreateFilled(layer_bounds); |
1471 | 1477 |
1472 FakePictureLayerTilingClient pending_client; | 1478 FakePictureLayerTilingClient pending_client; |
1473 pending_client.SetTileSize(gfx::Size(64, 64)); | 1479 pending_client.SetTileSize(gfx::Size(64, 64)); |
1474 | 1480 |
1475 scoped_ptr<PictureLayerTilingSet> tiling_set = PictureLayerTilingSet::Create( | 1481 std::unique_ptr<PictureLayerTilingSet> tiling_set = |
1476 WhichTree::ACTIVE_TREE, &pending_client, 1.0f, 1.0f, 1000); | 1482 PictureLayerTilingSet::Create(WhichTree::ACTIVE_TREE, &pending_client, |
| 1483 1.0f, 1.0f, 1000); |
1477 pending_client.set_twin_tiling_set(tiling_set.get()); | 1484 pending_client.set_twin_tiling_set(tiling_set.get()); |
1478 | 1485 |
1479 auto* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1486 auto* tiling = tiling_set->AddTiling(1.0f, raster_source); |
1480 | 1487 |
1481 tiling->set_resolution(HIGH_RESOLUTION); | 1488 tiling->set_resolution(HIGH_RESOLUTION); |
1482 tiling->CreateAllTilesForTesting(); | 1489 tiling->CreateAllTilesForTesting(); |
1483 | 1490 |
1484 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting | 1491 // The tile is (0, 0, 1, 1), create an intersecting and non-intersecting |
1485 // rectangle to test the advance phase with. The tile size is (64, 64), so | 1492 // rectangle to test the advance phase with. The tile size is (64, 64), so |
1486 // both rectangles intersect the tile content size, but only one should | 1493 // both rectangles intersect the tile content size, but only one should |
1487 // intersect the actual size. | 1494 // intersect the actual size. |
1488 gfx::Rect non_intersecting_rect(2, 2, 10, 10); | 1495 gfx::Rect non_intersecting_rect(2, 2, 10, 10); |
1489 gfx::Rect intersecting_rect(0, 0, 10, 10); | 1496 gfx::Rect intersecting_rect(0, 0, 10, 10); |
1490 { | 1497 { |
1491 tiling->SetTilePriorityRectsForTesting( | 1498 tiling->SetTilePriorityRectsForTesting( |
1492 non_intersecting_rect, // Visible rect. | 1499 non_intersecting_rect, // Visible rect. |
1493 intersecting_rect, // Skewport rect. | 1500 intersecting_rect, // Skewport rect. |
1494 intersecting_rect, // Soon rect. | 1501 intersecting_rect, // Soon rect. |
1495 intersecting_rect); // Eventually rect. | 1502 intersecting_rect); // Eventually rect. |
1496 scoped_ptr<TilingSetRasterQueueAll> queue( | 1503 std::unique_ptr<TilingSetRasterQueueAll> queue( |
1497 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1504 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1498 EXPECT_FALSE(queue->IsEmpty()); | 1505 EXPECT_FALSE(queue->IsEmpty()); |
1499 } | 1506 } |
1500 { | 1507 { |
1501 tiling->SetTilePriorityRectsForTesting( | 1508 tiling->SetTilePriorityRectsForTesting( |
1502 non_intersecting_rect, // Visible rect. | 1509 non_intersecting_rect, // Visible rect. |
1503 non_intersecting_rect, // Skewport rect. | 1510 non_intersecting_rect, // Skewport rect. |
1504 intersecting_rect, // Soon rect. | 1511 intersecting_rect, // Soon rect. |
1505 intersecting_rect); // Eventually rect. | 1512 intersecting_rect); // Eventually rect. |
1506 scoped_ptr<TilingSetRasterQueueAll> queue( | 1513 std::unique_ptr<TilingSetRasterQueueAll> queue( |
1507 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1514 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1508 EXPECT_FALSE(queue->IsEmpty()); | 1515 EXPECT_FALSE(queue->IsEmpty()); |
1509 } | 1516 } |
1510 { | 1517 { |
1511 tiling->SetTilePriorityRectsForTesting( | 1518 tiling->SetTilePriorityRectsForTesting( |
1512 non_intersecting_rect, // Visible rect. | 1519 non_intersecting_rect, // Visible rect. |
1513 non_intersecting_rect, // Skewport rect. | 1520 non_intersecting_rect, // Skewport rect. |
1514 non_intersecting_rect, // Soon rect. | 1521 non_intersecting_rect, // Soon rect. |
1515 intersecting_rect); // Eventually rect. | 1522 intersecting_rect); // Eventually rect. |
1516 scoped_ptr<TilingSetRasterQueueAll> queue( | 1523 std::unique_ptr<TilingSetRasterQueueAll> queue( |
1517 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1524 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1518 EXPECT_FALSE(queue->IsEmpty()); | 1525 EXPECT_FALSE(queue->IsEmpty()); |
1519 } | 1526 } |
1520 } | 1527 } |
1521 | 1528 |
1522 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { | 1529 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { |
1523 gfx::Size size(10, 10); | 1530 gfx::Size size(10, 10); |
1524 const gfx::Size layer_bounds(1000, 1000); | 1531 const gfx::Size layer_bounds(1000, 1000); |
1525 | 1532 |
1526 scoped_ptr<FakeRecordingSource> recording_source = | 1533 std::unique_ptr<FakeRecordingSource> recording_source = |
1527 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); | 1534 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); |
1528 | 1535 |
1529 SkPaint solid_paint; | 1536 SkPaint solid_paint; |
1530 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); | 1537 SkColor solid_color = SkColorSetARGB(255, 12, 23, 34); |
1531 solid_paint.setColor(solid_color); | 1538 solid_paint.setColor(solid_color); |
1532 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), | 1539 recording_source->add_draw_rect_with_paint(gfx::Rect(layer_bounds), |
1533 solid_paint); | 1540 solid_paint); |
1534 | 1541 |
1535 // Create non solid tile as well, otherwise tilings wouldnt be created. | 1542 // Create non solid tile as well, otherwise tilings wouldnt be created. |
1536 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); | 1543 SkColor non_solid_color = SkColorSetARGB(128, 45, 56, 67); |
1537 SkPaint non_solid_paint; | 1544 SkPaint non_solid_paint; |
1538 non_solid_paint.setColor(non_solid_color); | 1545 non_solid_paint.setColor(non_solid_color); |
1539 | 1546 |
1540 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), | 1547 recording_source->add_draw_rect_with_paint(gfx::Rect(0, 0, 10, 10), |
1541 non_solid_paint); | 1548 non_solid_paint); |
1542 recording_source->Rerecord(); | 1549 recording_source->Rerecord(); |
1543 | 1550 |
1544 scoped_refptr<RasterSource> raster_source = | 1551 scoped_refptr<RasterSource> raster_source = |
1545 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1552 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1546 | 1553 |
1547 FakePictureLayerTilingClient tiling_client; | 1554 FakePictureLayerTilingClient tiling_client; |
1548 tiling_client.SetTileSize(size); | 1555 tiling_client.SetTileSize(size); |
1549 | 1556 |
1550 scoped_ptr<PictureLayerImpl> layer_impl = | 1557 std::unique_ptr<PictureLayerImpl> layer_impl = |
1551 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false); | 1558 PictureLayerImpl::Create(host_impl_.active_tree(), 1, false); |
1552 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); | 1559 PictureLayerTilingSet* tiling_set = layer_impl->picture_layer_tiling_set(); |
1553 | 1560 |
1554 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); | 1561 PictureLayerTiling* tiling = tiling_set->AddTiling(1.0f, raster_source); |
1555 tiling->set_resolution(HIGH_RESOLUTION); | 1562 tiling->set_resolution(HIGH_RESOLUTION); |
1556 tiling->CreateAllTilesForTesting(); | 1563 tiling->CreateAllTilesForTesting(); |
1557 tiling->SetTilePriorityRectsForTesting( | 1564 tiling->SetTilePriorityRectsForTesting( |
1558 gfx::Rect(layer_bounds), // Visible rect. | 1565 gfx::Rect(layer_bounds), // Visible rect. |
1559 gfx::Rect(layer_bounds), // Skewport rect. | 1566 gfx::Rect(layer_bounds), // Skewport rect. |
1560 gfx::Rect(layer_bounds), // Soon rect. | 1567 gfx::Rect(layer_bounds), // Soon rect. |
(...skipping 14 matching lines...) Expand all Loading... |
1575 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); | 1582 EXPECT_EQ(solid_color, tile->draw_info().solid_color()); |
1576 } | 1583 } |
1577 } | 1584 } |
1578 } | 1585 } |
1579 | 1586 |
1580 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. | 1587 // TODO(vmpstr): Merge TileManagerTest and TileManagerTilePriorityQueueTest. |
1581 class TileManagerTest : public testing::Test { | 1588 class TileManagerTest : public testing::Test { |
1582 public: | 1589 public: |
1583 TileManagerTest() | 1590 TileManagerTest() |
1584 : output_surface_(FakeOutputSurface::CreateSoftware( | 1591 : output_surface_(FakeOutputSurface::CreateSoftware( |
1585 make_scoped_ptr(new SoftwareOutputDevice))) {} | 1592 base::WrapUnique(new SoftwareOutputDevice))) {} |
1586 | 1593 |
1587 void SetUp() override { | 1594 void SetUp() override { |
1588 LayerTreeSettings settings; | 1595 LayerTreeSettings settings; |
1589 CustomizeSettings(&settings); | 1596 CustomizeSettings(&settings); |
1590 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, | 1597 host_impl_.reset(new MockLayerTreeHostImpl(settings, &task_runner_provider_, |
1591 &shared_bitmap_manager_, | 1598 &shared_bitmap_manager_, |
1592 &task_graph_runner_)); | 1599 &task_graph_runner_)); |
1593 host_impl_->SetVisible(true); | 1600 host_impl_->SetVisible(true); |
1594 host_impl_->InitializeRenderer(output_surface_.get()); | 1601 host_impl_->InitializeRenderer(output_surface_.get()); |
1595 } | 1602 } |
(...skipping 27 matching lines...) Expand all Loading... |
1623 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | 1630 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); |
1624 | 1631 |
1625 // Steal from the recycled tree. | 1632 // Steal from the recycled tree. |
1626 LayerImpl* old_pending_root = pending_tree->root_layer(); | 1633 LayerImpl* old_pending_root = pending_tree->root_layer(); |
1627 FakePictureLayerImpl* pending_layer = nullptr; | 1634 FakePictureLayerImpl* pending_layer = nullptr; |
1628 if (old_pending_root) { | 1635 if (old_pending_root) { |
1629 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); | 1636 pending_layer = static_cast<FakePictureLayerImpl*>(old_pending_root); |
1630 pending_layer->SetRasterSourceOnPending(raster_source, Region()); | 1637 pending_layer->SetRasterSourceOnPending(raster_source, Region()); |
1631 } else { | 1638 } else { |
1632 int id = 7; | 1639 int id = 7; |
1633 scoped_ptr<FakePictureLayerImpl> new_root = | 1640 std::unique_ptr<FakePictureLayerImpl> new_root = |
1634 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id, | 1641 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, id, |
1635 raster_source); | 1642 raster_source); |
1636 pending_layer = new_root.get(); | 1643 pending_layer = new_root.get(); |
1637 pending_layer->SetDrawsContent(true); | 1644 pending_layer->SetDrawsContent(true); |
1638 pending_layer->SetHasRenderSurface(true); | 1645 pending_layer->SetHasRenderSurface(true); |
1639 pending_tree->SetRootLayer(std::move(new_root)); | 1646 pending_tree->SetRootLayer(std::move(new_root)); |
1640 } | 1647 } |
1641 | 1648 |
1642 // The bounds() just mirror the raster source size. | 1649 // The bounds() just mirror the raster source size. |
1643 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 1650 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
(...skipping 19 matching lines...) Expand all Loading... |
1663 | 1670 |
1664 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); | 1671 MOCK_METHOD0(NotifyAllTileTasksCompleted, void()); |
1665 }; | 1672 }; |
1666 | 1673 |
1667 // By default do no customization. | 1674 // By default do no customization. |
1668 virtual void CustomizeSettings(LayerTreeSettings* settings) {} | 1675 virtual void CustomizeSettings(LayerTreeSettings* settings) {} |
1669 | 1676 |
1670 TestSharedBitmapManager shared_bitmap_manager_; | 1677 TestSharedBitmapManager shared_bitmap_manager_; |
1671 TestTaskGraphRunner task_graph_runner_; | 1678 TestTaskGraphRunner task_graph_runner_; |
1672 FakeImplTaskRunnerProvider task_runner_provider_; | 1679 FakeImplTaskRunnerProvider task_runner_provider_; |
1673 scoped_ptr<OutputSurface> output_surface_; | 1680 std::unique_ptr<OutputSurface> output_surface_; |
1674 scoped_ptr<MockLayerTreeHostImpl> host_impl_; | 1681 std::unique_ptr<MockLayerTreeHostImpl> host_impl_; |
1675 }; | 1682 }; |
1676 | 1683 |
1677 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is | 1684 // Test to ensure that we call NotifyAllTileTasksCompleted when PrepareTiles is |
1678 // called. | 1685 // called. |
1679 TEST_F(TileManagerTest, AllWorkFinishedTest) { | 1686 TEST_F(TileManagerTest, AllWorkFinishedTest) { |
1680 // Check with no tile work enqueued. | 1687 // Check with no tile work enqueued. |
1681 { | 1688 { |
1682 base::RunLoop run_loop; | 1689 base::RunLoop run_loop; |
1683 EXPECT_FALSE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); | 1690 EXPECT_FALSE(host_impl_->tile_manager()->HasScheduledTileTasksForTesting()); |
1684 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) | 1691 EXPECT_CALL(*host_impl_, NotifyAllTileTasksCompleted()) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1744 SCOPED_TRACE(resolutions[i]); | 1751 SCOPED_TRACE(resolutions[i]); |
1745 | 1752 |
1746 // Make a RasterSource that will draw a blue bitmap image. | 1753 // Make a RasterSource that will draw a blue bitmap image. |
1747 sk_sp<SkSurface> surface = | 1754 sk_sp<SkSurface> surface = |
1748 SkSurface::MakeRasterN32Premul(size.width(), size.height()); | 1755 SkSurface::MakeRasterN32Premul(size.width(), size.height()); |
1749 ASSERT_NE(surface, nullptr); | 1756 ASSERT_NE(surface, nullptr); |
1750 surface->getCanvas()->clear(SK_ColorBLUE); | 1757 surface->getCanvas()->clear(SK_ColorBLUE); |
1751 skia::RefPtr<SkImage> blue_image = | 1758 skia::RefPtr<SkImage> blue_image = |
1752 skia::AdoptRef(surface->newImageSnapshot()); | 1759 skia::AdoptRef(surface->newImageSnapshot()); |
1753 | 1760 |
1754 scoped_ptr<FakeRecordingSource> recording_source = | 1761 std::unique_ptr<FakeRecordingSource> recording_source = |
1755 FakeRecordingSource::CreateFilledRecordingSource(size); | 1762 FakeRecordingSource::CreateFilledRecordingSource(size); |
1756 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); | 1763 recording_source->SetBackgroundColor(SK_ColorTRANSPARENT); |
1757 recording_source->SetRequiresClear(true); | 1764 recording_source->SetRequiresClear(true); |
1758 recording_source->SetClearCanvasWithDebugColor(false); | 1765 recording_source->SetClearCanvasWithDebugColor(false); |
1759 SkPaint paint; | 1766 SkPaint paint; |
1760 paint.setColor(SK_ColorGREEN); | 1767 paint.setColor(SK_ColorGREEN); |
1761 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); | 1768 recording_source->add_draw_rect_with_paint(gfx::Rect(size), paint); |
1762 recording_source->add_draw_image(blue_image.get(), gfx::Point()); | 1769 recording_source->add_draw_image(blue_image.get(), gfx::Point()); |
1763 recording_source->Rerecord(); | 1770 recording_source->Rerecord(); |
1764 scoped_refptr<RasterSource> raster = | 1771 scoped_refptr<RasterSource> raster = |
1765 RasterSource::CreateFromRecordingSource(recording_source.get(), false); | 1772 RasterSource::CreateFromRecordingSource(recording_source.get(), false); |
1766 | 1773 |
1767 FakePictureLayerTilingClient tiling_client; | 1774 FakePictureLayerTilingClient tiling_client; |
1768 tiling_client.SetTileSize(size); | 1775 tiling_client.SetTileSize(size); |
1769 | 1776 |
1770 scoped_ptr<PictureLayerImpl> layer = | 1777 std::unique_ptr<PictureLayerImpl> layer = |
1771 PictureLayerImpl::Create(host_impl_->active_tree(), 1, false); | 1778 PictureLayerImpl::Create(host_impl_->active_tree(), 1, false); |
1772 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); | 1779 PictureLayerTilingSet* tiling_set = layer->picture_layer_tiling_set(); |
1773 | 1780 |
1774 auto* tiling = tiling_set->AddTiling(1.0f, raster); | 1781 auto* tiling = tiling_set->AddTiling(1.0f, raster); |
1775 tiling->set_resolution(resolutions[i]); | 1782 tiling->set_resolution(resolutions[i]); |
1776 tiling->CreateAllTilesForTesting(); | 1783 tiling->CreateAllTilesForTesting(); |
1777 tiling->SetTilePriorityRectsForTesting( | 1784 tiling->SetTilePriorityRectsForTesting( |
1778 gfx::Rect(size), // Visible rect. | 1785 gfx::Rect(size), // Visible rect. |
1779 gfx::Rect(size), // Skewport rect. | 1786 gfx::Rect(size), // Skewport rect. |
1780 gfx::Rect(size), // Soon rect. | 1787 gfx::Rect(size), // Soon rect. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1832 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { | 1839 ResourceFormat GetResourceFormat(bool must_support_alpha) const override { |
1833 return ResourceFormat::RGBA_8888; | 1840 return ResourceFormat::RGBA_8888; |
1834 } | 1841 } |
1835 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { | 1842 bool GetResourceRequiresSwizzle(bool must_support_alpha) const override { |
1836 return false; | 1843 return false; |
1837 } | 1844 } |
1838 | 1845 |
1839 void ScheduleTasks(TaskGraph* graph) override {} | 1846 void ScheduleTasks(TaskGraph* graph) override {} |
1840 | 1847 |
1841 // TileTaskClient methods. | 1848 // TileTaskClient methods. |
1842 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 1849 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
1843 const Resource* resource, | 1850 const Resource* resource, |
1844 uint64_t resource_content_id, | 1851 uint64_t resource_content_id, |
1845 uint64_t previous_content_id) override { | 1852 uint64_t previous_content_id) override { |
1846 NOTREACHED(); | 1853 NOTREACHED(); |
1847 return nullptr; | 1854 return nullptr; |
1848 } | 1855 } |
1849 void ReleaseBufferForRaster(scoped_ptr<RasterBuffer> buffer) override {} | 1856 void ReleaseBufferForRaster(std::unique_ptr<RasterBuffer> buffer) override {} |
1850 }; | 1857 }; |
1851 | 1858 |
1852 // Fake TileTaskRunner that just cancels all scheduled tasks immediately. | 1859 // Fake TileTaskRunner that just cancels all scheduled tasks immediately. |
1853 class CancellingTileTaskRunner : public FakeTileTaskRunner { | 1860 class CancellingTileTaskRunner : public FakeTileTaskRunner { |
1854 public: | 1861 public: |
1855 CancellingTileTaskRunner() {} | 1862 CancellingTileTaskRunner() {} |
1856 ~CancellingTileTaskRunner() override {} | 1863 ~CancellingTileTaskRunner() override {} |
1857 | 1864 |
1858 void ScheduleTasks(TaskGraph* graph) override { | 1865 void ScheduleTasks(TaskGraph* graph) override { |
1859 // Just call CompleteOnOriginThread on each item in the queue. As none of | 1866 // Just call CompleteOnOriginThread on each item in the queue. As none of |
(...skipping 23 matching lines...) Expand all Loading... |
1883 const int kLayerId = 7; | 1890 const int kLayerId = 7; |
1884 const uint64_t kInvalidatedId = 43; | 1891 const uint64_t kInvalidatedId = 43; |
1885 const gfx::Size kTileSize(128, 128); | 1892 const gfx::Size kTileSize(128, 128); |
1886 | 1893 |
1887 scoped_refptr<FakeRasterSource> pending_raster_source = | 1894 scoped_refptr<FakeRasterSource> pending_raster_source = |
1888 FakeRasterSource::CreateFilled(kTileSize); | 1895 FakeRasterSource::CreateFilled(kTileSize); |
1889 host_impl_->CreatePendingTree(); | 1896 host_impl_->CreatePendingTree(); |
1890 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); | 1897 LayerTreeImpl* pending_tree = host_impl_->pending_tree(); |
1891 | 1898 |
1892 // Steal from the recycled tree. | 1899 // Steal from the recycled tree. |
1893 scoped_ptr<FakePictureLayerImpl> pending_layer = | 1900 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
1894 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, | 1901 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, |
1895 pending_raster_source); | 1902 pending_raster_source); |
1896 pending_layer->SetDrawsContent(true); | 1903 pending_layer->SetDrawsContent(true); |
1897 pending_layer->SetHasRenderSurface(true); | 1904 pending_layer->SetHasRenderSurface(true); |
1898 | 1905 |
1899 // The bounds() just mirror the raster source size. | 1906 // The bounds() just mirror the raster source size. |
1900 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 1907 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
1901 pending_tree->SetRootLayer(std::move(pending_layer)); | 1908 pending_tree->SetRootLayer(std::move(pending_layer)); |
1902 | 1909 |
1903 // Add tilings/tiles for the layer. | 1910 // Add tilings/tiles for the layer. |
1904 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); | 1911 host_impl_->pending_tree()->BuildPropertyTreesForTesting(); |
1905 host_impl_->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 1912 host_impl_->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
1906 | 1913 |
1907 // Build the raster queue and invalidate the top tile. | 1914 // Build the raster queue and invalidate the top tile. |
1908 scoped_ptr<RasterTilePriorityQueue> queue(host_impl_->BuildRasterQueue( | 1915 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl_->BuildRasterQueue( |
1909 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 1916 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
1910 EXPECT_FALSE(queue->IsEmpty()); | 1917 EXPECT_FALSE(queue->IsEmpty()); |
1911 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); | 1918 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); |
1912 | 1919 |
1913 // PrepareTiles to schedule tasks. Due to the CancellingTileTaskRunner, these | 1920 // PrepareTiles to schedule tasks. Due to the CancellingTileTaskRunner, these |
1914 // tasks will immediately be canceled. | 1921 // tasks will immediately be canceled. |
1915 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); | 1922 host_impl_->tile_manager()->PrepareTiles(host_impl_->global_tile_state()); |
1916 | 1923 |
1917 // Make sure that the tile we invalidated above was not returned to the pool | 1924 // Make sure that the tile we invalidated above was not returned to the pool |
1918 // with its invalidated resource ID. | 1925 // with its invalidated resource ID. |
(...skipping 17 matching lines...) Expand all Loading... |
1936 for (const auto& node : graph->nodes) { | 1943 for (const auto& node : graph->nodes) { |
1937 TileTask* task = static_cast<TileTask*>(node.task); | 1944 TileTask* task = static_cast<TileTask*>(node.task); |
1938 // Triggers a call to AcquireBufferForRaster. | 1945 // Triggers a call to AcquireBufferForRaster. |
1939 task->ScheduleOnOriginThread(this); | 1946 task->ScheduleOnOriginThread(this); |
1940 // Calls TileManager as though task was cancelled. | 1947 // Calls TileManager as though task was cancelled. |
1941 task->CompleteOnOriginThread(this); | 1948 task->CompleteOnOriginThread(this); |
1942 } | 1949 } |
1943 } | 1950 } |
1944 | 1951 |
1945 // TileTaskClient methods. | 1952 // TileTaskClient methods. |
1946 scoped_ptr<RasterBuffer> AcquireBufferForRaster( | 1953 std::unique_ptr<RasterBuffer> AcquireBufferForRaster( |
1947 const Resource* resource, | 1954 const Resource* resource, |
1948 uint64_t resource_content_id, | 1955 uint64_t resource_content_id, |
1949 uint64_t previous_content_id) override { | 1956 uint64_t previous_content_id) override { |
1950 EXPECT_EQ(expected_resource_id_, resource_content_id); | 1957 EXPECT_EQ(expected_resource_id_, resource_content_id); |
1951 return nullptr; | 1958 return nullptr; |
1952 } | 1959 } |
1953 | 1960 |
1954 private: | 1961 private: |
1955 uint64_t expected_resource_id_; | 1962 uint64_t expected_resource_id_; |
1956 }; | 1963 }; |
1957 | 1964 |
1958 // Runs a test to ensure that partial raster is either enabled or disabled, | 1965 // Runs a test to ensure that partial raster is either enabled or disabled, |
1959 // depending on |partial_raster_enabled|'s value. Takes ownership of host_impl | 1966 // depending on |partial_raster_enabled|'s value. Takes ownership of host_impl |
1960 // so that cleanup order can be controlled. | 1967 // so that cleanup order can be controlled. |
1961 void RunPartialRasterCheck(scoped_ptr<LayerTreeHostImpl> host_impl, | 1968 void RunPartialRasterCheck(std::unique_ptr<LayerTreeHostImpl> host_impl, |
1962 bool partial_raster_enabled) { | 1969 bool partial_raster_enabled) { |
1963 // Pick arbitrary IDs - they don't really matter as long as they're constant. | 1970 // Pick arbitrary IDs - they don't really matter as long as they're constant. |
1964 const int kLayerId = 7; | 1971 const int kLayerId = 7; |
1965 const uint64_t kInvalidatedId = 43; | 1972 const uint64_t kInvalidatedId = 43; |
1966 const uint64_t kExpectedId = partial_raster_enabled ? kInvalidatedId : 0u; | 1973 const uint64_t kExpectedId = partial_raster_enabled ? kInvalidatedId : 0u; |
1967 const gfx::Size kTileSize(128, 128); | 1974 const gfx::Size kTileSize(128, 128); |
1968 | 1975 |
1969 // Create a VerifyResourceContentIdTileTaskRunner to ensure that the raster | 1976 // Create a VerifyResourceContentIdTileTaskRunner to ensure that the raster |
1970 // task we see is created with |kExpectedId|. | 1977 // task we see is created with |kExpectedId|. |
1971 VerifyResourceContentIdTileTaskRunner verifying_runner(kExpectedId); | 1978 VerifyResourceContentIdTileTaskRunner verifying_runner(kExpectedId); |
1972 host_impl->tile_manager()->SetTileTaskRunnerForTesting(&verifying_runner); | 1979 host_impl->tile_manager()->SetTileTaskRunnerForTesting(&verifying_runner); |
1973 | 1980 |
1974 // Ensure there's a resource with our |kInvalidatedId| in the resource pool. | 1981 // Ensure there's a resource with our |kInvalidatedId| in the resource pool. |
1975 host_impl->resource_pool()->ReleaseResource( | 1982 host_impl->resource_pool()->ReleaseResource( |
1976 host_impl->resource_pool()->AcquireResource(kTileSize, RGBA_8888), | 1983 host_impl->resource_pool()->AcquireResource(kTileSize, RGBA_8888), |
1977 kInvalidatedId); | 1984 kInvalidatedId); |
1978 host_impl->resource_pool()->CheckBusyResources(); | 1985 host_impl->resource_pool()->CheckBusyResources(); |
1979 | 1986 |
1980 scoped_refptr<FakeRasterSource> pending_raster_source = | 1987 scoped_refptr<FakeRasterSource> pending_raster_source = |
1981 FakeRasterSource::CreateFilled(kTileSize); | 1988 FakeRasterSource::CreateFilled(kTileSize); |
1982 host_impl->CreatePendingTree(); | 1989 host_impl->CreatePendingTree(); |
1983 LayerTreeImpl* pending_tree = host_impl->pending_tree(); | 1990 LayerTreeImpl* pending_tree = host_impl->pending_tree(); |
1984 | 1991 |
1985 // Steal from the recycled tree. | 1992 // Steal from the recycled tree. |
1986 scoped_ptr<FakePictureLayerImpl> pending_layer = | 1993 std::unique_ptr<FakePictureLayerImpl> pending_layer = |
1987 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, | 1994 FakePictureLayerImpl::CreateWithRasterSource(pending_tree, kLayerId, |
1988 pending_raster_source); | 1995 pending_raster_source); |
1989 pending_layer->SetDrawsContent(true); | 1996 pending_layer->SetDrawsContent(true); |
1990 pending_layer->SetHasRenderSurface(true); | 1997 pending_layer->SetHasRenderSurface(true); |
1991 | 1998 |
1992 // The bounds() just mirror the raster source size. | 1999 // The bounds() just mirror the raster source size. |
1993 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); | 2000 pending_layer->SetBounds(pending_layer->raster_source()->GetSize()); |
1994 pending_tree->SetRootLayer(std::move(pending_layer)); | 2001 pending_tree->SetRootLayer(std::move(pending_layer)); |
1995 | 2002 |
1996 // Add tilings/tiles for the layer. | 2003 // Add tilings/tiles for the layer. |
1997 host_impl->pending_tree()->BuildPropertyTreesForTesting(); | 2004 host_impl->pending_tree()->BuildPropertyTreesForTesting(); |
1998 host_impl->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); | 2005 host_impl->pending_tree()->UpdateDrawProperties(false /* update_lcd_text */); |
1999 | 2006 |
2000 // Build the raster queue and invalidate the top tile. | 2007 // Build the raster queue and invalidate the top tile. |
2001 scoped_ptr<RasterTilePriorityQueue> queue(host_impl->BuildRasterQueue( | 2008 std::unique_ptr<RasterTilePriorityQueue> queue(host_impl->BuildRasterQueue( |
2002 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); | 2009 SAME_PRIORITY_FOR_BOTH_TREES, RasterTilePriorityQueue::Type::ALL)); |
2003 EXPECT_FALSE(queue->IsEmpty()); | 2010 EXPECT_FALSE(queue->IsEmpty()); |
2004 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); | 2011 queue->Top().tile()->SetInvalidated(gfx::Rect(), kInvalidatedId); |
2005 | 2012 |
2006 // PrepareTiles to schedule tasks. Due to the | 2013 // PrepareTiles to schedule tasks. Due to the |
2007 // VerifyPreviousContentTileTaskRunner, these tasks will verified and | 2014 // VerifyPreviousContentTileTaskRunner, these tasks will verified and |
2008 // cancelled. | 2015 // cancelled. |
2009 host_impl->tile_manager()->PrepareTiles(host_impl->global_tile_state()); | 2016 host_impl->tile_manager()->PrepareTiles(host_impl->global_tile_state()); |
2010 | 2017 |
2011 // Free our host_impl before the cancelling_runner we passed it, as it will | 2018 // Free our host_impl before the cancelling_runner we passed it, as it will |
(...skipping 10 matching lines...) Expand all Loading... |
2022 | 2029 |
2023 // Ensures that the tile manager does not attempt to reuse tiles when partial | 2030 // Ensures that the tile manager does not attempt to reuse tiles when partial |
2024 // raster is disabled. | 2031 // raster is disabled. |
2025 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { | 2032 TEST_F(TileManagerTest, PartialRasterSuccessfullyDisabled) { |
2026 RunPartialRasterCheck(std::move(host_impl_), | 2033 RunPartialRasterCheck(std::move(host_impl_), |
2027 false /* partial_raster_enabled */); | 2034 false /* partial_raster_enabled */); |
2028 } | 2035 } |
2029 | 2036 |
2030 } // namespace | 2037 } // namespace |
2031 } // namespace cc | 2038 } // namespace cc |
OLD | NEW |