Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1655)

Side by Side Diff: cc/tiles/tile_manager_unittest.cc

Issue 2899403003: cc: Give non-drawing layers that are rasterized a lower priority. (Closed)
Patch Set: type Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/tiles/raster_tile_priority_queue_all.cc ('k') | cc/tiles/tiling_set_raster_queue_all.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1163 1163
1164 // The explanation of each iteration is as follows: 1164 // The explanation of each iteration is as follows:
1165 // 1. First iteration tests that we can get all of the tiles correctly. 1165 // 1. First iteration tests that we can get all of the tiles correctly.
1166 // 2. Second iteration ensures that we can get all of the tiles again (first 1166 // 2. Second iteration ensures that we can get all of the tiles again (first
1167 // iteration didn't change any tiles), as well set all tiles to be ready to 1167 // iteration didn't change any tiles), as well set all tiles to be ready to
1168 // draw. 1168 // draw.
1169 // 3. Third iteration ensures that no tiles are returned, since they were all 1169 // 3. Third iteration ensures that no tiles are returned, since they were all
1170 // marked as ready to draw. 1170 // marked as ready to draw.
1171 for (int i = 0; i < 3; ++i) { 1171 for (int i = 0; i < 3; ++i) {
1172 std::unique_ptr<TilingSetRasterQueueAll> queue( 1172 std::unique_ptr<TilingSetRasterQueueAll> queue(
1173 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1173 new TilingSetRasterQueueAll(tiling_set.get(), false, false));
1174 1174
1175 // There are 3 bins in TilePriority. 1175 // There are 3 bins in TilePriority.
1176 bool have_tiles[3] = {}; 1176 bool have_tiles[3] = {};
1177 1177
1178 // On the third iteration, we should get no tiles since everything was 1178 // On the third iteration, we should get no tiles since everything was
1179 // marked as ready to draw. 1179 // marked as ready to draw.
1180 if (i == 2) { 1180 if (i == 2) {
1181 EXPECT_TRUE(queue->IsEmpty()); 1181 EXPECT_TRUE(queue->IsEmpty());
1182 continue; 1182 continue;
1183 } 1183 }
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 const int soon_border_outset = 312; 1275 const int soon_border_outset = 312;
1276 gfx::Rect soon_rect = moved_viewport; 1276 gfx::Rect soon_rect = moved_viewport;
1277 soon_rect.Inset(-soon_border_outset, -soon_border_outset); 1277 soon_rect.Inset(-soon_border_outset, -soon_border_outset);
1278 1278
1279 // There are 3 bins in TilePriority. 1279 // There are 3 bins in TilePriority.
1280 bool have_tiles[3] = {}; 1280 bool have_tiles[3] = {};
1281 PrioritizedTile last_tile; 1281 PrioritizedTile last_tile;
1282 int eventually_bin_order_correct_count = 0; 1282 int eventually_bin_order_correct_count = 0;
1283 int eventually_bin_order_incorrect_count = 0; 1283 int eventually_bin_order_incorrect_count = 0;
1284 std::unique_ptr<TilingSetRasterQueueAll> queue( 1284 std::unique_ptr<TilingSetRasterQueueAll> queue(
1285 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1285 new TilingSetRasterQueueAll(tiling_set.get(), false, false));
1286 for (; !queue->IsEmpty(); queue->Pop()) { 1286 for (; !queue->IsEmpty(); queue->Pop()) {
1287 if (!last_tile.tile()) 1287 if (!last_tile.tile())
1288 last_tile = queue->Top(); 1288 last_tile = queue->Top();
1289 1289
1290 const PrioritizedTile& new_tile = queue->Top(); 1290 const PrioritizedTile& new_tile = queue->Top();
1291 1291
1292 TilePriority last_priority = last_tile.priority(); 1292 TilePriority last_priority = last_tile.priority();
1293 TilePriority new_priority = new_tile.priority(); 1293 TilePriority new_priority = new_tile.priority();
1294 1294
1295 have_tiles[new_priority.priority_bin] = true; 1295 have_tiles[new_priority.priority_bin] = true;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 // intersect the actual size. 1432 // intersect the actual size.
1433 gfx::Rect non_intersecting_rect(2, 2, 10, 10); 1433 gfx::Rect non_intersecting_rect(2, 2, 10, 10);
1434 gfx::Rect intersecting_rect(0, 0, 10, 10); 1434 gfx::Rect intersecting_rect(0, 0, 10, 10);
1435 { 1435 {
1436 tiling->SetTilePriorityRectsForTesting( 1436 tiling->SetTilePriorityRectsForTesting(
1437 non_intersecting_rect, // Visible rect. 1437 non_intersecting_rect, // Visible rect.
1438 intersecting_rect, // Skewport rect. 1438 intersecting_rect, // Skewport rect.
1439 intersecting_rect, // Soon rect. 1439 intersecting_rect, // Soon rect.
1440 intersecting_rect); // Eventually rect. 1440 intersecting_rect); // Eventually rect.
1441 std::unique_ptr<TilingSetRasterQueueAll> queue( 1441 std::unique_ptr<TilingSetRasterQueueAll> queue(
1442 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1442 new TilingSetRasterQueueAll(tiling_set.get(), false, false));
1443 EXPECT_FALSE(queue->IsEmpty()); 1443 EXPECT_FALSE(queue->IsEmpty());
1444 } 1444 }
1445 { 1445 {
1446 tiling->SetTilePriorityRectsForTesting( 1446 tiling->SetTilePriorityRectsForTesting(
1447 non_intersecting_rect, // Visible rect. 1447 non_intersecting_rect, // Visible rect.
1448 non_intersecting_rect, // Skewport rect. 1448 non_intersecting_rect, // Skewport rect.
1449 intersecting_rect, // Soon rect. 1449 intersecting_rect, // Soon rect.
1450 intersecting_rect); // Eventually rect. 1450 intersecting_rect); // Eventually rect.
1451 std::unique_ptr<TilingSetRasterQueueAll> queue( 1451 std::unique_ptr<TilingSetRasterQueueAll> queue(
1452 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1452 new TilingSetRasterQueueAll(tiling_set.get(), false, false));
1453 EXPECT_FALSE(queue->IsEmpty()); 1453 EXPECT_FALSE(queue->IsEmpty());
1454 } 1454 }
1455 { 1455 {
1456 tiling->SetTilePriorityRectsForTesting( 1456 tiling->SetTilePriorityRectsForTesting(
1457 non_intersecting_rect, // Visible rect. 1457 non_intersecting_rect, // Visible rect.
1458 non_intersecting_rect, // Skewport rect. 1458 non_intersecting_rect, // Skewport rect.
1459 non_intersecting_rect, // Soon rect. 1459 non_intersecting_rect, // Soon rect.
1460 intersecting_rect); // Eventually rect. 1460 intersecting_rect); // Eventually rect.
1461 std::unique_ptr<TilingSetRasterQueueAll> queue( 1461 std::unique_ptr<TilingSetRasterQueueAll> queue(
1462 new TilingSetRasterQueueAll(tiling_set.get(), false)); 1462 new TilingSetRasterQueueAll(tiling_set.get(), false, false));
1463 EXPECT_FALSE(queue->IsEmpty()); 1463 EXPECT_FALSE(queue->IsEmpty());
1464 } 1464 }
1465 } 1465 }
1466 1466
1467 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) { 1467 TEST_F(TileManagerTilePriorityQueueTest, NoRasterTasksforSolidColorTiles) {
1468 gfx::Size size(10, 10); 1468 gfx::Size size(10, 10);
1469 const gfx::Size layer_bounds(1000, 1000); 1469 const gfx::Size layer_bounds(1000, 1000);
1470 1470
1471 std::unique_ptr<FakeRecordingSource> recording_source = 1471 std::unique_ptr<FakeRecordingSource> recording_source =
1472 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds); 1472 FakeRecordingSource::CreateFilledRecordingSource(layer_bounds);
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2648 EXPECT_TRUE(tile); 2648 EXPECT_TRUE(tile);
2649 else 2649 else
2650 EXPECT_FALSE(tile); 2650 EXPECT_FALSE(tile);
2651 } 2651 }
2652 } 2652 }
2653 host_impl()->client()->reset_did_request_impl_side_invalidation(); 2653 host_impl()->client()->reset_did_request_impl_side_invalidation();
2654 } 2654 }
2655 2655
2656 } // namespace 2656 } // namespace
2657 } // namespace cc 2657 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/raster_tile_priority_queue_all.cc ('k') | cc/tiles/tiling_set_raster_queue_all.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698