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/fake_impl_proxy.h" | 9 #include "cc/test/fake_impl_proxy.h" |
10 #include "cc/test/fake_layer_tree_host_impl.h" | 10 #include "cc/test/fake_layer_tree_host_impl.h" |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 invalidation, gfx::Size(1000, 1000)); | 639 invalidation, gfx::Size(1000, 1000)); |
640 pending_layer_->LowResTiling()->UpdateTilesToCurrentPile( | 640 pending_layer_->LowResTiling()->UpdateTilesToCurrentPile( |
641 invalidation, gfx::Size(1000, 1000)); | 641 invalidation, gfx::Size(1000, 1000)); |
642 | 642 |
643 active_layer_->ResetAllTilesPriorities(); | 643 active_layer_->ResetAllTilesPriorities(); |
644 pending_layer_->ResetAllTilesPriorities(); | 644 pending_layer_->ResetAllTilesPriorities(); |
645 | 645 |
646 // Renew all of the tile priorities. | 646 // Renew all of the tile priorities. |
647 gfx::Rect viewport(50, 50, 100, 100); | 647 gfx::Rect viewport(50, 50, 100, 100); |
648 pending_layer_->HighResTiling()->UpdateTilePriorities( | 648 pending_layer_->HighResTiling()->UpdateTilePriorities( |
649 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 649 PENDING_TREE, |
| 650 viewport, |
| 651 1.0f, |
| 652 1.0, |
| 653 NULL, |
| 654 pending_layer_->render_target(), |
| 655 pending_layer_->draw_transform()); |
650 pending_layer_->LowResTiling()->UpdateTilePriorities( | 656 pending_layer_->LowResTiling()->UpdateTilePriorities( |
651 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 657 PENDING_TREE, |
| 658 viewport, |
| 659 1.0f, |
| 660 1.0, |
| 661 NULL, |
| 662 pending_layer_->render_target(), |
| 663 pending_layer_->draw_transform()); |
652 active_layer_->HighResTiling()->UpdateTilePriorities( | 664 active_layer_->HighResTiling()->UpdateTilePriorities( |
653 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); | 665 ACTIVE_TREE, |
| 666 viewport, |
| 667 1.0f, |
| 668 1.0, |
| 669 NULL, |
| 670 active_layer_->render_target(), |
| 671 active_layer_->draw_transform()); |
654 active_layer_->LowResTiling()->UpdateTilePriorities( | 672 active_layer_->LowResTiling()->UpdateTilePriorities( |
655 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); | 673 ACTIVE_TREE, |
| 674 viewport, |
| 675 1.0f, |
| 676 1.0, |
| 677 NULL, |
| 678 active_layer_->render_target(), |
| 679 active_layer_->draw_transform()); |
656 | 680 |
657 // Populate all tiles directly from the tilings. | 681 // Populate all tiles directly from the tilings. |
658 all_tiles.clear(); | 682 all_tiles.clear(); |
659 std::vector<Tile*> pending_high_res_tiles = | 683 std::vector<Tile*> pending_high_res_tiles = |
660 pending_layer_->HighResTiling()->AllTilesForTesting(); | 684 pending_layer_->HighResTiling()->AllTilesForTesting(); |
661 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) | 685 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) |
662 all_tiles.insert(pending_high_res_tiles[i]); | 686 all_tiles.insert(pending_high_res_tiles[i]); |
663 | 687 |
664 std::vector<Tile*> pending_low_res_tiles = | 688 std::vector<Tile*> pending_low_res_tiles = |
665 pending_layer_->LowResTiling()->AllTilesForTesting(); | 689 pending_layer_->LowResTiling()->AllTilesForTesting(); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 invalidation, gfx::Size(1000, 1000)); | 838 invalidation, gfx::Size(1000, 1000)); |
815 pending_layer_->LowResTiling()->UpdateTilesToCurrentPile( | 839 pending_layer_->LowResTiling()->UpdateTilesToCurrentPile( |
816 invalidation, gfx::Size(1000, 1000)); | 840 invalidation, gfx::Size(1000, 1000)); |
817 | 841 |
818 active_layer_->ResetAllTilesPriorities(); | 842 active_layer_->ResetAllTilesPriorities(); |
819 pending_layer_->ResetAllTilesPriorities(); | 843 pending_layer_->ResetAllTilesPriorities(); |
820 | 844 |
821 // Renew all of the tile priorities. | 845 // Renew all of the tile priorities. |
822 gfx::Rect viewport(50, 50, 100, 100); | 846 gfx::Rect viewport(50, 50, 100, 100); |
823 pending_layer_->HighResTiling()->UpdateTilePriorities( | 847 pending_layer_->HighResTiling()->UpdateTilePriorities( |
824 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 848 PENDING_TREE, |
| 849 viewport, |
| 850 1.0f, |
| 851 1.0, |
| 852 NULL, |
| 853 pending_layer_->render_target(), |
| 854 pending_layer_->draw_transform()); |
825 pending_layer_->LowResTiling()->UpdateTilePriorities( | 855 pending_layer_->LowResTiling()->UpdateTilePriorities( |
826 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 856 PENDING_TREE, |
| 857 viewport, |
| 858 1.0f, |
| 859 1.0, |
| 860 NULL, |
| 861 pending_layer_->render_target(), |
| 862 pending_layer_->draw_transform()); |
827 active_layer_->HighResTiling()->UpdateTilePriorities( | 863 active_layer_->HighResTiling()->UpdateTilePriorities( |
828 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); | 864 ACTIVE_TREE, |
| 865 viewport, |
| 866 1.0f, |
| 867 1.0, |
| 868 NULL, |
| 869 active_layer_->render_target(), |
| 870 active_layer_->draw_transform()); |
829 active_layer_->LowResTiling()->UpdateTilePriorities( | 871 active_layer_->LowResTiling()->UpdateTilePriorities( |
830 ACTIVE_TREE, viewport, 1.0f, 1.0, Occlusion()); | 872 ACTIVE_TREE, |
| 873 viewport, |
| 874 1.0f, |
| 875 1.0, |
| 876 NULL, |
| 877 active_layer_->render_target(), |
| 878 active_layer_->draw_transform()); |
831 | 879 |
832 // Populate all tiles directly from the tilings. | 880 // Populate all tiles directly from the tilings. |
833 all_tiles.clear(); | 881 all_tiles.clear(); |
834 std::vector<Tile*> pending_high_res_tiles = | 882 std::vector<Tile*> pending_high_res_tiles = |
835 pending_layer_->HighResTiling()->AllTilesForTesting(); | 883 pending_layer_->HighResTiling()->AllTilesForTesting(); |
836 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) | 884 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) |
837 all_tiles.insert(pending_high_res_tiles[i]); | 885 all_tiles.insert(pending_high_res_tiles[i]); |
838 | 886 |
839 std::vector<Tile*> pending_low_res_tiles = | 887 std::vector<Tile*> pending_low_res_tiles = |
840 pending_layer_->LowResTiling()->AllTilesForTesting(); | 888 pending_layer_->LowResTiling()->AllTilesForTesting(); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 raster_queue.Pop(); | 1013 raster_queue.Pop(); |
966 } | 1014 } |
967 EXPECT_EQ(tile_count, all_tiles.size()); | 1015 EXPECT_EQ(tile_count, all_tiles.size()); |
968 EXPECT_EQ(34u, tile_count); | 1016 EXPECT_EQ(34u, tile_count); |
969 | 1017 |
970 pending_layer_->ResetAllTilesPriorities(); | 1018 pending_layer_->ResetAllTilesPriorities(); |
971 | 1019 |
972 // Renew all of the tile priorities. | 1020 // Renew all of the tile priorities. |
973 gfx::Rect viewport(layer_bounds); | 1021 gfx::Rect viewport(layer_bounds); |
974 pending_layer_->HighResTiling()->UpdateTilePriorities( | 1022 pending_layer_->HighResTiling()->UpdateTilePriorities( |
975 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 1023 PENDING_TREE, |
| 1024 viewport, |
| 1025 1.0f, |
| 1026 1.0, |
| 1027 NULL, |
| 1028 pending_layer_->render_target(), |
| 1029 pending_layer_->draw_transform()); |
976 pending_layer_->LowResTiling()->UpdateTilePriorities( | 1030 pending_layer_->LowResTiling()->UpdateTilePriorities( |
977 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 1031 PENDING_TREE, |
| 1032 viewport, |
| 1033 1.0f, |
| 1034 1.0, |
| 1035 NULL, |
| 1036 pending_layer_->render_target(), |
| 1037 pending_layer_->draw_transform()); |
978 pending_child_layer->HighResTiling()->UpdateTilePriorities( | 1038 pending_child_layer->HighResTiling()->UpdateTilePriorities( |
979 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 1039 PENDING_TREE, |
| 1040 viewport, |
| 1041 1.0f, |
| 1042 1.0, |
| 1043 NULL, |
| 1044 pending_child_layer->render_target(), |
| 1045 pending_child_layer->draw_transform()); |
980 pending_child_layer->LowResTiling()->UpdateTilePriorities( | 1046 pending_child_layer->LowResTiling()->UpdateTilePriorities( |
981 PENDING_TREE, viewport, 1.0f, 1.0, Occlusion()); | 1047 PENDING_TREE, |
| 1048 viewport, |
| 1049 1.0f, |
| 1050 1.0, |
| 1051 NULL, |
| 1052 pending_child_layer->render_target(), |
| 1053 pending_child_layer->draw_transform()); |
982 | 1054 |
983 // Populate all tiles directly from the tilings. | 1055 // Populate all tiles directly from the tilings. |
984 all_tiles.clear(); | 1056 all_tiles.clear(); |
985 std::vector<Tile*> pending_high_res_tiles = | 1057 std::vector<Tile*> pending_high_res_tiles = |
986 pending_layer_->HighResTiling()->AllTilesForTesting(); | 1058 pending_layer_->HighResTiling()->AllTilesForTesting(); |
987 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) | 1059 for (size_t i = 0; i < pending_high_res_tiles.size(); ++i) |
988 all_tiles.insert(pending_high_res_tiles[i]); | 1060 all_tiles.insert(pending_high_res_tiles[i]); |
989 | 1061 |
990 std::vector<Tile*> pending_low_res_tiles = | 1062 std::vector<Tile*> pending_low_res_tiles = |
991 pending_layer_->LowResTiling()->AllTilesForTesting(); | 1063 pending_layer_->LowResTiling()->AllTilesForTesting(); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 all_tiles.insert(queue.Top()); | 1213 all_tiles.insert(queue.Top()); |
1142 ++tile_count; | 1214 ++tile_count; |
1143 queue.Pop(); | 1215 queue.Pop(); |
1144 } | 1216 } |
1145 EXPECT_EQ(tile_count, all_tiles.size()); | 1217 EXPECT_EQ(tile_count, all_tiles.size()); |
1146 EXPECT_EQ(17u, tile_count); | 1218 EXPECT_EQ(17u, tile_count); |
1147 } | 1219 } |
1148 | 1220 |
1149 } // namespace | 1221 } // namespace |
1150 } // namespace cc | 1222 } // namespace cc |
OLD | NEW |