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/resources/tiling_set_raster_queue_all.h" | 9 #include "cc/resources/tiling_set_raster_queue_all.h" |
10 #include "cc/test/begin_frame_args_test.h" | 10 #include "cc/test/begin_frame_args_test.h" |
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 EXPECT_EQ(841u, all_tiles.size()); | 1097 EXPECT_EQ(841u, all_tiles.size()); |
1098 | 1098 |
1099 // The explanation of each iteration is as follows: | 1099 // The explanation of each iteration is as follows: |
1100 // 1. First iteration tests that we can get all of the tiles correctly. | 1100 // 1. First iteration tests that we can get all of the tiles correctly. |
1101 // 2. Second iteration ensures that we can get all of the tiles again (first | 1101 // 2. Second iteration ensures that we can get all of the tiles again (first |
1102 // iteration didn't change any tiles), as well set all tiles to be ready to | 1102 // iteration didn't change any tiles), as well set all tiles to be ready to |
1103 // draw. | 1103 // draw. |
1104 // 3. Third iteration ensures that no tiles are returned, since they were all | 1104 // 3. Third iteration ensures that no tiles are returned, since they were all |
1105 // marked as ready to draw. | 1105 // marked as ready to draw. |
1106 for (int i = 0; i < 3; ++i) { | 1106 for (int i = 0; i < 3; ++i) { |
1107 scoped_ptr<TilingSetRasterQueue> queue( | 1107 scoped_ptr<TilingSetRasterQueueAll> queue( |
1108 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1108 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1109 | 1109 |
1110 // There are 3 bins in TilePriority. | 1110 // There are 3 bins in TilePriority. |
1111 bool have_tiles[3] = {}; | 1111 bool have_tiles[3] = {}; |
1112 | 1112 |
1113 // On the third iteration, we should get no tiles since everything was | 1113 // On the third iteration, we should get no tiles since everything was |
1114 // marked as ready to draw. | 1114 // marked as ready to draw. |
1115 if (i == 2) { | 1115 if (i == 2) { |
1116 EXPECT_TRUE(queue->IsEmpty()); | 1116 EXPECT_TRUE(queue->IsEmpty()); |
1117 continue; | 1117 continue; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 true); | 1207 true); |
1208 | 1208 |
1209 gfx::Rect soon_rect = moved_viewport; | 1209 gfx::Rect soon_rect = moved_viewport; |
1210 soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); | 1210 soon_rect.Inset(-312.f, -312.f, -312.f, -312.f); |
1211 | 1211 |
1212 // There are 3 bins in TilePriority. | 1212 // There are 3 bins in TilePriority. |
1213 bool have_tiles[3] = {}; | 1213 bool have_tiles[3] = {}; |
1214 Tile* last_tile = NULL; | 1214 Tile* last_tile = NULL; |
1215 int eventually_bin_order_correct_count = 0; | 1215 int eventually_bin_order_correct_count = 0; |
1216 int eventually_bin_order_incorrect_count = 0; | 1216 int eventually_bin_order_incorrect_count = 0; |
1217 scoped_ptr<TilingSetRasterQueue> queue( | 1217 scoped_ptr<TilingSetRasterQueueAll> queue( |
1218 new TilingSetRasterQueueAll(tiling_set.get(), false)); | 1218 new TilingSetRasterQueueAll(tiling_set.get(), false)); |
1219 for (; !queue->IsEmpty(); queue->Pop()) { | 1219 for (; !queue->IsEmpty(); queue->Pop()) { |
1220 if (!last_tile) | 1220 if (!last_tile) |
1221 last_tile = queue->Top(); | 1221 last_tile = queue->Top(); |
1222 | 1222 |
1223 Tile* new_tile = queue->Top(); | 1223 Tile* new_tile = queue->Top(); |
1224 | 1224 |
1225 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); | 1225 TilePriority last_priority = last_tile->priority(ACTIVE_TREE); |
1226 TilePriority new_priority = new_tile->priority(ACTIVE_TREE); | 1226 TilePriority new_priority = new_tile->priority(ACTIVE_TREE); |
1227 | 1227 |
(...skipping 20 matching lines...) Expand all Loading... |
1248 EXPECT_GT(eventually_bin_order_correct_count, | 1248 EXPECT_GT(eventually_bin_order_correct_count, |
1249 eventually_bin_order_incorrect_count); | 1249 eventually_bin_order_incorrect_count); |
1250 | 1250 |
1251 EXPECT_TRUE(have_tiles[TilePriority::NOW]); | 1251 EXPECT_TRUE(have_tiles[TilePriority::NOW]); |
1252 EXPECT_TRUE(have_tiles[TilePriority::SOON]); | 1252 EXPECT_TRUE(have_tiles[TilePriority::SOON]); |
1253 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); | 1253 EXPECT_TRUE(have_tiles[TilePriority::EVENTUALLY]); |
1254 } | 1254 } |
1255 | 1255 |
1256 } // namespace | 1256 } // namespace |
1257 } // namespace cc | 1257 } // namespace cc |
OLD | NEW |