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

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

Issue 2680313007: cc: Remove resource freed tiles from tile manager pending gpu work set. (Closed)
Patch Set: nits Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 scheduled_raster_task_limit_ = scheduled_raster_task_limit; 418 scheduled_raster_task_limit_ = scheduled_raster_task_limit;
419 resource_pool_ = resource_pool; 419 resource_pool_ = resource_pool;
420 image_controller_.SetImageDecodeCache(image_decode_cache); 420 image_controller_.SetImageDecodeCache(image_decode_cache);
421 tile_task_manager_ = TileTaskManagerImpl::Create(task_graph_runner); 421 tile_task_manager_ = TileTaskManagerImpl::Create(task_graph_runner);
422 raster_buffer_provider_ = raster_buffer_provider; 422 raster_buffer_provider_ = raster_buffer_provider;
423 } 423 }
424 424
425 void TileManager::Release(Tile* tile) { 425 void TileManager::Release(Tile* tile) {
426 FreeResourcesForTile(tile); 426 FreeResourcesForTile(tile);
427 tiles_.erase(tile->id()); 427 tiles_.erase(tile->id());
428 pending_gpu_work_tiles_.erase(tile);
429 } 428 }
430 429
431 void TileManager::DidFinishRunningTileTasksRequiredForActivation() { 430 void TileManager::DidFinishRunningTileTasksRequiredForActivation() {
432 TRACE_EVENT0("cc", 431 TRACE_EVENT0("cc",
433 "TileManager::DidFinishRunningTileTasksRequiredForActivation"); 432 "TileManager::DidFinishRunningTileTasksRequiredForActivation");
434 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state", 433 TRACE_EVENT_ASYNC_STEP_INTO1("cc", "ScheduledTasks", this, "running", "state",
435 ScheduledTasksStateAsValue()); 434 ScheduledTasksStateAsValue());
436 // TODO(vmpstr): Temporary check to debug crbug.com/642927. 435 // TODO(vmpstr): Temporary check to debug crbug.com/642927.
437 CHECK(tile_task_manager_); 436 CHECK(tile_task_manager_);
438 signals_.ready_to_activate = true; 437 signals_.ready_to_activate = true;
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 "all_tiles_that_need_to_be_rasterized_are_scheduled", 794 "all_tiles_that_need_to_be_rasterized_are_scheduled",
796 all_tiles_that_need_to_be_rasterized_are_scheduled_, 795 all_tiles_that_need_to_be_rasterized_are_scheduled_,
797 "had_enough_memory_to_schedule_tiles_needed_now", 796 "had_enough_memory_to_schedule_tiles_needed_now",
798 had_enough_memory_to_schedule_tiles_needed_now); 797 had_enough_memory_to_schedule_tiles_needed_now);
799 return work_to_schedule; 798 return work_to_schedule;
800 } 799 }
801 800
802 void TileManager::FreeResourcesForTile(Tile* tile) { 801 void TileManager::FreeResourcesForTile(Tile* tile) {
803 TileDrawInfo& draw_info = tile->draw_info(); 802 TileDrawInfo& draw_info = tile->draw_info();
804 Resource* resource = draw_info.TakeResource(); 803 Resource* resource = draw_info.TakeResource();
805 if (resource) 804 if (resource) {
806 resource_pool_->ReleaseResource(resource); 805 resource_pool_->ReleaseResource(resource);
806 pending_gpu_work_tiles_.erase(tile);
807 }
807 } 808 }
808 809
809 void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw( 810 void TileManager::FreeResourcesForTileAndNotifyClientIfTileWasReadyToDraw(
810 Tile* tile) { 811 Tile* tile) {
811 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw(); 812 bool was_ready_to_draw = tile->draw_info().IsReadyToDraw();
812 FreeResourcesForTile(tile); 813 FreeResourcesForTile(tile);
813 if (was_ready_to_draw) 814 if (was_ready_to_draw)
814 client_->NotifyTileStateChanged(tile); 815 client_->NotifyTileStateChanged(tile);
815 } 816 }
816 817
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 } 1307 }
1307 1308
1308 void TileManager::CheckPendingGpuWorkTiles(bool issue_signals) { 1309 void TileManager::CheckPendingGpuWorkTiles(bool issue_signals) {
1309 ResourceProvider::ResourceIdArray required_for_activation_ids; 1310 ResourceProvider::ResourceIdArray required_for_activation_ids;
1310 ResourceProvider::ResourceIdArray required_for_draw_ids; 1311 ResourceProvider::ResourceIdArray required_for_draw_ids;
1311 1312
1312 for (auto it = pending_gpu_work_tiles_.begin(); 1313 for (auto it = pending_gpu_work_tiles_.begin();
1313 it != pending_gpu_work_tiles_.end();) { 1314 it != pending_gpu_work_tiles_.end();) {
1314 Tile* tile = *it; 1315 Tile* tile = *it;
1315 const Resource* resource = tile->draw_info().resource(); 1316 const Resource* resource = tile->draw_info().resource();
1317 DCHECK(resource);
1316 1318
1317 if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY || 1319 if (global_state_.tree_priority != SMOOTHNESS_TAKES_PRIORITY ||
1318 raster_buffer_provider_->IsResourceReadyToDraw(resource->id())) { 1320 raster_buffer_provider_->IsResourceReadyToDraw(resource->id())) {
1319 tile->draw_info().set_resource_ready_for_draw(); 1321 tile->draw_info().set_resource_ready_for_draw();
1320 client_->NotifyTileStateChanged(tile); 1322 client_->NotifyTileStateChanged(tile);
1321 it = pending_gpu_work_tiles_.erase(it); 1323 it = pending_gpu_work_tiles_.erase(it);
1322 continue; 1324 continue;
1323 } 1325 }
1324 1326
1325 // TODO(ericrk): If a tile in our list no longer has valid tile priorities, 1327 // TODO(ericrk): If a tile in our list no longer has valid tile priorities,
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 all_tile_tasks_completed = false; 1457 all_tile_tasks_completed = false;
1456 did_notify_all_tile_tasks_completed = false; 1458 did_notify_all_tile_tasks_completed = false;
1457 } 1459 }
1458 1460
1459 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default; 1461 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule() = default;
1460 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule( 1462 TileManager::PrioritizedWorkToSchedule::PrioritizedWorkToSchedule(
1461 PrioritizedWorkToSchedule&& other) = default; 1463 PrioritizedWorkToSchedule&& other) = default;
1462 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default; 1464 TileManager::PrioritizedWorkToSchedule::~PrioritizedWorkToSchedule() = default;
1463 1465
1464 } // namespace cc 1466 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698