Chromium Code Reviews| 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 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 891 all_tiles.insert(active_high_res_tiles[i]); | 891 all_tiles.insert(active_high_res_tiles[i]); |
| 892 | 892 |
| 893 std::vector<Tile*> active_low_res_tiles = | 893 std::vector<Tile*> active_low_res_tiles = |
| 894 active_layer_->LowResTiling()->AllTilesForTesting(); | 894 active_layer_->LowResTiling()->AllTilesForTesting(); |
| 895 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) | 895 for (size_t i = 0; i < active_low_res_tiles.size(); ++i) |
| 896 all_tiles.insert(active_low_res_tiles[i]); | 896 all_tiles.insert(active_low_res_tiles[i]); |
| 897 | 897 |
| 898 tile_manager()->InitializeTilesWithResourcesForTesting( | 898 tile_manager()->InitializeTilesWithResourcesForTesting( |
| 899 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); | 899 std::vector<Tile*>(all_tiles.begin(), all_tiles.end())); |
| 900 | 900 |
| 901 pending_layer_->MarkVisibleResourcesAsRequired(); | |
|
vmpstr
2014/08/14 06:23:49
This line alone (without the other changes in the
| |
| 902 | |
| 901 Tile* last_tile = NULL; | 903 Tile* last_tile = NULL; |
| 902 smoothness_tiles.clear(); | 904 smoothness_tiles.clear(); |
| 903 tile_count = 0; | 905 tile_count = 0; |
| 904 // Here we expect to get increasing ACTIVE_TREE priority_bin. | 906 // Here we expect to get increasing ACTIVE_TREE priority_bin. |
| 905 queue.Reset(); | 907 queue.Reset(); |
| 906 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); | 908 host_impl_.BuildEvictionQueue(&queue, SMOOTHNESS_TAKES_PRIORITY); |
| 907 while (!queue.IsEmpty()) { | 909 while (!queue.IsEmpty()) { |
| 908 Tile* tile = queue.Top(); | 910 Tile* tile = queue.Top(); |
| 909 EXPECT_TRUE(tile); | 911 EXPECT_TRUE(tile); |
| 910 EXPECT_TRUE(tile->HasResources()); | 912 EXPECT_TRUE(tile->HasResources()); |
| 911 | 913 |
| 912 if (!last_tile) | 914 if (!last_tile) |
| 913 last_tile = tile; | 915 last_tile = tile; |
| 914 | 916 |
| 915 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin, | 917 EXPECT_GE(last_tile->priority(ACTIVE_TREE).priority_bin, |
| 916 tile->priority(ACTIVE_TREE).priority_bin); | 918 tile->priority(ACTIVE_TREE).priority_bin); |
| 917 if (last_tile->priority(ACTIVE_TREE).priority_bin == | 919 if (last_tile->priority(ACTIVE_TREE).priority_bin == |
| 918 tile->priority(ACTIVE_TREE).priority_bin) { | 920 tile->priority(ACTIVE_TREE).priority_bin) { |
| 919 EXPECT_GE(last_tile->priority(ACTIVE_TREE).distance_to_visible, | 921 EXPECT_LE(last_tile->required_for_activation(), |
| 920 tile->priority(ACTIVE_TREE).distance_to_visible); | 922 tile->required_for_activation()); |
| 923 if (last_tile->required_for_activation() == | |
| 924 tile->required_for_activation()) { | |
| 925 EXPECT_GE(last_tile->priority(ACTIVE_TREE).distance_to_visible, | |
| 926 tile->priority(ACTIVE_TREE).distance_to_visible); | |
| 927 } | |
| 921 } | 928 } |
| 922 | 929 |
| 923 last_tile = tile; | 930 last_tile = tile; |
| 924 ++tile_count; | 931 ++tile_count; |
| 925 smoothness_tiles.insert(tile); | 932 smoothness_tiles.insert(tile); |
| 926 queue.Pop(); | 933 queue.Pop(); |
| 927 } | 934 } |
| 928 | 935 |
| 929 EXPECT_EQ(tile_count, smoothness_tiles.size()); | 936 EXPECT_EQ(tile_count, smoothness_tiles.size()); |
| 930 EXPECT_EQ(all_tiles, smoothness_tiles); | 937 EXPECT_EQ(all_tiles, smoothness_tiles); |
| 931 | 938 |
| 932 std::set<Tile*> new_content_tiles; | 939 std::set<Tile*> new_content_tiles; |
| 933 last_tile = NULL; | 940 last_tile = NULL; |
| 934 // Here we expect to get increasing PENDING_TREE priority_bin. | 941 // Here we expect to get increasing PENDING_TREE priority_bin. |
| 935 queue.Reset(); | 942 queue.Reset(); |
| 936 host_impl_.BuildEvictionQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); | 943 host_impl_.BuildEvictionQueue(&queue, NEW_CONTENT_TAKES_PRIORITY); |
| 937 while (!queue.IsEmpty()) { | 944 while (!queue.IsEmpty()) { |
| 938 Tile* tile = queue.Top(); | 945 Tile* tile = queue.Top(); |
| 939 EXPECT_TRUE(tile); | 946 EXPECT_TRUE(tile); |
| 940 | 947 |
| 941 if (!last_tile) | 948 if (!last_tile) |
| 942 last_tile = tile; | 949 last_tile = tile; |
| 943 | 950 |
| 944 EXPECT_GE(last_tile->priority(PENDING_TREE).priority_bin, | 951 EXPECT_GE(last_tile->priority(PENDING_TREE).priority_bin, |
| 945 tile->priority(PENDING_TREE).priority_bin); | 952 tile->priority(PENDING_TREE).priority_bin); |
| 946 if (last_tile->priority(PENDING_TREE).priority_bin == | 953 if (last_tile->priority(PENDING_TREE).priority_bin == |
| 947 tile->priority(PENDING_TREE).priority_bin) { | 954 tile->priority(PENDING_TREE).priority_bin) { |
| 948 EXPECT_GE(last_tile->priority(PENDING_TREE).distance_to_visible, | 955 EXPECT_LE(last_tile->required_for_activation(), |
| 949 tile->priority(PENDING_TREE).distance_to_visible); | 956 tile->required_for_activation()); |
| 957 if (last_tile->required_for_activation() == | |
| 958 tile->required_for_activation()) { | |
| 959 EXPECT_GE(last_tile->priority(PENDING_TREE).distance_to_visible, | |
| 960 tile->priority(PENDING_TREE).distance_to_visible); | |
| 961 } | |
| 950 } | 962 } |
| 951 | 963 |
| 952 last_tile = tile; | 964 last_tile = tile; |
| 953 new_content_tiles.insert(tile); | 965 new_content_tiles.insert(tile); |
| 954 queue.Pop(); | 966 queue.Pop(); |
| 955 } | 967 } |
| 956 | 968 |
| 957 EXPECT_EQ(tile_count, new_content_tiles.size()); | 969 EXPECT_EQ(tile_count, new_content_tiles.size()); |
| 958 EXPECT_EQ(all_tiles, new_content_tiles); | 970 EXPECT_EQ(all_tiles, new_content_tiles); |
| 959 } | 971 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1197 all_tiles.insert(queue.Top()); | 1209 all_tiles.insert(queue.Top()); |
| 1198 ++tile_count; | 1210 ++tile_count; |
| 1199 queue.Pop(); | 1211 queue.Pop(); |
| 1200 } | 1212 } |
| 1201 EXPECT_EQ(tile_count, all_tiles.size()); | 1213 EXPECT_EQ(tile_count, all_tiles.size()); |
| 1202 EXPECT_EQ(17u, tile_count); | 1214 EXPECT_EQ(17u, tile_count); |
| 1203 } | 1215 } |
| 1204 | 1216 |
| 1205 } // namespace | 1217 } // namespace |
| 1206 } // namespace cc | 1218 } // namespace cc |
| OLD | NEW |