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