OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/tiles/tile_manager.h" | 5 #include "cc/tiles/tile_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 delete tile; | 407 delete tile; |
408 } | 408 } |
409 released_tiles_.swap(tiles_to_retain); | 409 released_tiles_.swap(tiles_to_retain); |
410 } | 410 } |
411 | 411 |
412 void TileManager::DidFinishRunningTileTasksRequiredForActivation() { | 412 void TileManager::DidFinishRunningTileTasksRequiredForActivation() { |
413 TRACE_EVENT0("cc", | 413 TRACE_EVENT0("cc", |
414 "TileManager::DidFinishRunningTileTasksRequiredForActivation"); | 414 "TileManager::DidFinishRunningTileTasksRequiredForActivation"); |
415 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", | 415 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", |
416 ScheduledTasksStateAsValue()); | 416 ScheduledTasksStateAsValue()); |
| 417 // TODO(vmpstr): Temporary check to debug crbug.com/642927. |
| 418 CHECK(tile_task_manager_); |
417 signals_.ready_to_activate = true; | 419 signals_.ready_to_activate = true; |
418 signals_check_notifier_.Schedule(); | 420 signals_check_notifier_.Schedule(); |
419 } | 421 } |
420 | 422 |
421 void TileManager::DidFinishRunningTileTasksRequiredForDraw() { | 423 void TileManager::DidFinishRunningTileTasksRequiredForDraw() { |
422 TRACE_EVENT0("cc", "TileManager::DidFinishRunningTileTasksRequiredForDraw"); | 424 TRACE_EVENT0("cc", "TileManager::DidFinishRunningTileTasksRequiredForDraw"); |
423 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", | 425 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", |
424 ScheduledTasksStateAsValue()); | 426 ScheduledTasksStateAsValue()); |
| 427 // TODO(vmpstr): Temporary check to debug crbug.com/642927. |
| 428 CHECK(tile_task_manager_); |
425 signals_.ready_to_draw = true; | 429 signals_.ready_to_draw = true; |
426 signals_check_notifier_.Schedule(); | 430 signals_check_notifier_.Schedule(); |
427 } | 431 } |
428 | 432 |
429 void TileManager::DidFinishRunningAllTileTasks() { | 433 void TileManager::DidFinishRunningAllTileTasks() { |
430 TRACE_EVENT0("cc", "TileManager::DidFinishRunningAllTileTasks"); | 434 TRACE_EVENT0("cc", "TileManager::DidFinishRunningAllTileTasks"); |
431 TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this); | 435 TRACE_EVENT_ASYNC_END0("cc", "ScheduledTasks", this); |
432 DCHECK(resource_pool_); | 436 DCHECK(resource_pool_); |
433 DCHECK(tile_task_manager_); | 437 DCHECK(tile_task_manager_); |
434 | 438 |
435 has_scheduled_tile_tasks_ = false; | 439 has_scheduled_tile_tasks_ = false; |
436 | 440 |
437 bool memory_usage_above_limit = resource_pool_->memory_usage_bytes() > | 441 bool memory_usage_above_limit = resource_pool_->memory_usage_bytes() > |
438 global_state_.soft_memory_limit_in_bytes; | 442 global_state_.soft_memory_limit_in_bytes; |
439 | 443 |
440 if (all_tiles_that_need_to_be_rasterized_are_scheduled_ && | 444 if (all_tiles_that_need_to_be_rasterized_are_scheduled_ && |
441 !memory_usage_above_limit) { | 445 !memory_usage_above_limit) { |
442 // TODO(ericrk): We should find a better way to safely handle re-entrant | 446 // TODO(ericrk): We should find a better way to safely handle re-entrant |
443 // notifications than always having to schedule a new task. | 447 // notifications than always having to schedule a new task. |
444 // http://crbug.com/498439 | 448 // http://crbug.com/498439 |
| 449 // TODO(vmpstr): Temporary check to debug crbug.com/642927. |
| 450 CHECK(tile_task_manager_); |
445 signals_.all_tile_tasks_completed = true; | 451 signals_.all_tile_tasks_completed = true; |
446 signals_check_notifier_.Schedule(); | 452 signals_check_notifier_.Schedule(); |
447 return; | 453 return; |
448 } | 454 } |
449 | 455 |
450 more_tiles_need_prepare_check_notifier_.Schedule(); | 456 more_tiles_need_prepare_check_notifier_.Schedule(); |
451 } | 457 } |
452 | 458 |
453 bool TileManager::PrepareTiles( | 459 bool TileManager::PrepareTiles( |
454 const GlobalStateThatImpactsTilePriority& state) { | 460 const GlobalStateThatImpactsTilePriority& state) { |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 image_manager_.UnrefImages(locked_images_); | 1148 image_manager_.UnrefImages(locked_images_); |
1143 locked_images_.clear(); | 1149 locked_images_.clear(); |
1144 locked_image_tasks_.clear(); | 1150 locked_image_tasks_.clear(); |
1145 } | 1151 } |
1146 | 1152 |
1147 FreeResourcesForReleasedTiles(); | 1153 FreeResourcesForReleasedTiles(); |
1148 | 1154 |
1149 resource_pool_->ReduceResourceUsage(); | 1155 resource_pool_->ReduceResourceUsage(); |
1150 image_manager_.ReduceMemoryUsage(); | 1156 image_manager_.ReduceMemoryUsage(); |
1151 | 1157 |
| 1158 // TODO(vmpstr): Temporary check to debug crbug.com/642927. |
| 1159 CHECK(tile_task_manager_); |
1152 signals_.all_tile_tasks_completed = true; | 1160 signals_.all_tile_tasks_completed = true; |
1153 signals_check_notifier_.Schedule(); | 1161 signals_check_notifier_.Schedule(); |
1154 | 1162 |
1155 // We don't reserve memory for required-for-activation tiles during | 1163 // We don't reserve memory for required-for-activation tiles during |
1156 // accelerated gestures, so we just postpone activation when we don't | 1164 // accelerated gestures, so we just postpone activation when we don't |
1157 // have these tiles, and activate after the accelerated gesture. | 1165 // have these tiles, and activate after the accelerated gesture. |
1158 // Likewise if we don't allow any tiles (as is the case when we're | 1166 // Likewise if we don't allow any tiles (as is the case when we're |
1159 // invisible), if we have tiles that aren't ready, then we shouldn't | 1167 // invisible), if we have tiles that aren't ready, then we shouldn't |
1160 // activate as activation can cause checkerboards. | 1168 // activate as activation can cause checkerboards. |
1161 bool wait_for_all_required_tiles = | 1169 bool wait_for_all_required_tiles = |
(...skipping 10 matching lines...) Expand all Loading... |
1172 // even when OOM. Note that we can't reuse the queue we used for | 1180 // even when OOM. Note that we can't reuse the queue we used for |
1173 // AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call could have | 1181 // AssignGpuMemoryToTiles, since the AssignGpuMemoryToTiles call could have |
1174 // evicted some tiles that would not be picked up by the old raster queue. | 1182 // evicted some tiles that would not be picked up by the old raster queue. |
1175 bool need_to_signal_activate = MarkTilesOutOfMemory(client_->BuildRasterQueue( | 1183 bool need_to_signal_activate = MarkTilesOutOfMemory(client_->BuildRasterQueue( |
1176 global_state_.tree_priority, | 1184 global_state_.tree_priority, |
1177 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); | 1185 RasterTilePriorityQueue::Type::REQUIRED_FOR_ACTIVATION)); |
1178 bool need_to_signal_draw = MarkTilesOutOfMemory(client_->BuildRasterQueue( | 1186 bool need_to_signal_draw = MarkTilesOutOfMemory(client_->BuildRasterQueue( |
1179 global_state_.tree_priority, | 1187 global_state_.tree_priority, |
1180 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); | 1188 RasterTilePriorityQueue::Type::REQUIRED_FOR_DRAW)); |
1181 | 1189 |
| 1190 // TODO(vmpstr): Temporary check to debug crbug.com/642927. |
| 1191 CHECK(tile_task_manager_); |
1182 DCHECK(IsReadyToActivate()); | 1192 DCHECK(IsReadyToActivate()); |
1183 DCHECK(IsReadyToDraw()); | 1193 DCHECK(IsReadyToDraw()); |
1184 signals_.ready_to_activate = need_to_signal_activate; | 1194 signals_.ready_to_activate = need_to_signal_activate; |
1185 signals_.ready_to_draw = need_to_signal_draw; | 1195 signals_.ready_to_draw = need_to_signal_draw; |
1186 // TODO(ericrk): Investigate why we need to schedule this (not just call it | 1196 // TODO(ericrk): Investigate why we need to schedule this (not just call it |
1187 // inline). http://crbug.com/498439 | 1197 // inline). http://crbug.com/498439 |
1188 signals_check_notifier_.Schedule(); | 1198 signals_check_notifier_.Schedule(); |
1189 } | 1199 } |
1190 | 1200 |
1191 bool TileManager::MarkTilesOutOfMemory( | 1201 bool TileManager::MarkTilesOutOfMemory( |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1314 all_tile_tasks_completed = false; | 1324 all_tile_tasks_completed = false; |
1315 did_notify_all_tile_tasks_completed = false; | 1325 did_notify_all_tile_tasks_completed = false; |
1316 } | 1326 } |
1317 | 1327 |
1318 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; | 1328 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; |
1319 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( | 1329 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( |
1320 PrioritizedWorkToSchedule&& other) = default; | 1330 PrioritizedWorkToSchedule&& other) = default; |
1321 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; | 1331 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; |
1322 | 1332 |
1323 } // namespace cc | 1333 } // namespace cc |
OLD | NEW |