Chromium Code Reviews| Index: cc/tiles/tile_manager.cc |
| diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc |
| index 0c15378545f86b7d9e6b14bc954e6ae3ee99e63b..425cfe8cc7f0d2bd7d89ab2ca66770083eca35b6 100644 |
| --- a/cc/tiles/tile_manager.cc |
| +++ b/cc/tiles/tile_manager.cc |
| @@ -345,7 +345,8 @@ RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats) { |
| TileManager::TileManager(TileManagerClient* client, |
| base::SequencedTaskRunner* task_runner, |
| size_t scheduled_raster_task_limit, |
| - bool use_partial_raster) |
| + bool use_partial_raster, |
| + bool check_tile_priority_inversion) |
| : client_(client), |
| task_runner_(task_runner), |
| resource_pool_(nullptr), |
| @@ -366,6 +367,7 @@ TileManager::TileManager(TileManagerClient* client, |
| has_scheduled_tile_tasks_(false), |
| prepare_tiles_count_(0u), |
| next_tile_id_(0u), |
| + check_tile_priority_inversion_(check_tile_priority_inversion), |
| task_set_finished_weak_ptr_factory_(this) {} |
| TileManager::~TileManager() { |
| @@ -753,6 +755,41 @@ TileManager::PrioritizedWorkToSchedule TileManager::AssignGpuMemoryToTiles() { |
| tile->draw_info().set_was_a_prepaint_tile(); |
| } |
| + // Debugging to check that remaining tiles in the priority queue are not in |
| + // the NOW bin and are required for neither activation nor draw. |
| + // This runs if the following conditions hold: |
| + // - check_tile_priority_inversion has been enabled. |
| + // - the loop above has processed all tiles that would be needed for any |
| + // signals to fire (that is, |
| + // all_tiles_that_need_to_be_rasterized_are_scheduled_ is true) |
| + // - Memory limit policy allows for any tiles to be scheduled at all (ie it's |
| + // not ALLOW_NOTHING). |
| + if (check_tile_priority_inversion_ && |
| + all_tiles_that_need_to_be_rasterized_are_scheduled_ && |
| + global_state_.memory_limit_policy != ALLOW_NOTHING) { |
| + TilePriority::PriorityBin highest_bin_found = TilePriority::NOW; |
| + for (; !raster_priority_queue->IsEmpty(); raster_priority_queue->Pop()) { |
| + const PrioritizedTile& prioritized_tile = raster_priority_queue->Top(); |
| + Tile* tile = prioritized_tile.tile(); |
| + TilePriority priority = prioritized_tile.priority(); |
| + |
| + if (priority.priority_bin > highest_bin_found) |
| + highest_bin_found = priority.priority_bin; |
|
sunnyps
2017/01/04 22:15:22
Shouldn't this be lowest bin (NOW < SOON < EVENTUA
vmpstr
2017/01/04 22:49:39
It's expected that tiles here would be in a higher
|
| + |
| + CHECK_NE(TilePriority::NOW, priority.priority_bin) |
| + << "mode: " << global_state_.tree_priority |
| + << " highest bin: " << highest_bin_found; |
| + CHECK(!tile->required_for_activation()) |
| + << "mode: " << global_state_.tree_priority |
| + << " bin: " << priority.priority_bin |
| + << " highest bin: " << highest_bin_found; |
| + CHECK(!tile->required_for_draw()) |
| + << "mode: " << global_state_.tree_priority |
| + << " bin: " << priority.priority_bin |
| + << " highest bin: " << highest_bin_found; |
| + } |
| + } |
| + |
| // Note that we should try and further reduce memory in case the above loop |
| // didn't reduce memory. This ensures that we always release as many resources |
| // as possible to stay within the memory limit. |