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