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

Unified Diff: cc/tiles/tile_manager.cc

Issue 2081883002: Reland of cc: Add mailbox support to ResourceProvider write locks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@worker_context_sync_tokens_revert
Patch Set: rebase Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/tile_manager.cc
diff --git a/cc/tiles/tile_manager.cc b/cc/tiles/tile_manager.cc
index aab3047b3343be0aa2a889f2258d490f2dae0a54..3f83286c06e957cad16ce59961d870bf35d2ee74 100644
--- a/cc/tiles/tile_manager.cc
+++ b/cc/tiles/tile_manager.cc
@@ -347,8 +347,9 @@ void TileManager::FinishTasksAndCleanUp() {
// uninitialized resources.
tile_task_manager_->Shutdown();
- // Now that all tasks have been finished, we can clear any
- // |orphan_tasks_|.
+ raster_buffer_provider_->Shutdown();
+
+ // Now that all tasks have been finished, we can clear any |orphan_tasks_|.
orphan_tasks_.clear();
tile_task_manager_->CheckForCompletedTasks();
@@ -370,6 +371,7 @@ void TileManager::FinishTasksAndCleanUp() {
void TileManager::SetResources(ResourcePool* resource_pool,
ImageDecodeController* image_decode_controller,
TileTaskManager* tile_task_manager,
+ RasterBufferProvider* raster_buffer_provider,
size_t scheduled_raster_task_limit,
bool use_gpu_rasterization) {
DCHECK(!tile_task_manager_);
@@ -380,6 +382,7 @@ void TileManager::SetResources(ResourcePool* resource_pool,
resource_pool_ = resource_pool;
image_decode_controller_ = image_decode_controller;
tile_task_manager_ = tile_task_manager;
+ raster_buffer_provider_ = raster_buffer_provider;
}
void TileManager::Release(Tile* tile) {
@@ -878,6 +881,11 @@ void TileManager::ScheduleTasks(
// below, so we do a swap instead of a move.
locked_images_.swap(new_locked_images);
+ // We must reduce the amount of unused resources before calling
+ // ScheduleTasks to prevent usage from rising above limits.
+ resource_pool_->ReduceResourceUsage();
+ image_decode_controller_->ReduceCacheUsage();
+
// Insert nodes for our task completion tasks. We enqueue these using
// NONCONCURRENT_FOREGROUND category this is the highest prioirty category and
// we'd like to run these tasks as soon as possible.
@@ -892,10 +900,8 @@ void TileManager::ScheduleTasks(
TASK_CATEGORY_NONCONCURRENT_FOREGROUND,
kAllDoneTaskPriority, all_count);
- // We must reduce the amount of unused resoruces before calling
- // ScheduleTasks to prevent usage from rising above limits.
- resource_pool_->ReduceResourceUsage();
- image_decode_controller_->ReduceCacheUsage();
+ // Synchronize worker with compositor.
+ raster_buffer_provider_->OrderingBarrier();
// Schedule running of |raster_queue_|. This replaces any previously
// scheduled tasks and effectively cancels all tasks not present
@@ -974,7 +980,7 @@ scoped_refptr<TileTask> TileManager::CreateRasterTask(
bool supports_concurrent_execution = !use_gpu_rasterization_;
std::unique_ptr<RasterBuffer> raster_buffer =
- tile_task_manager_->GetRasterBufferProvider()->AcquireBufferForRaster(
+ raster_buffer_provider_->AcquireBufferForRaster(
resource, resource_content_id, tile->invalidated_id());
return make_scoped_refptr(new RasterTaskImpl(
this, tile, resource, prioritized_tile.raster_source(), playback_settings,
@@ -989,8 +995,7 @@ void TileManager::OnRasterTaskCompleted(
bool was_canceled) {
DCHECK(tile);
DCHECK(tiles_.find(tile->id()) != tiles_.end());
- tile_task_manager_->GetRasterBufferProvider()->ReleaseBufferForRaster(
- std::move(raster_buffer));
+ raster_buffer_provider_->ReleaseBufferForRaster(std::move(raster_buffer));
TileDrawInfo& draw_info = tile->draw_info();
DCHECK(tile->raster_task_.get());
@@ -1046,6 +1051,11 @@ void TileManager::SetTileTaskManagerForTesting(
tile_task_manager_ = tile_task_manager;
}
+void TileManager::SetRasterBufferProviderForTesting(
+ RasterBufferProvider* raster_buffer_provider) {
+ raster_buffer_provider_ = raster_buffer_provider;
+}
+
bool TileManager::AreRequiredTilesReadyToDraw(
RasterTilePriorityQueue::Type type) const {
std::unique_ptr<RasterTilePriorityQueue> raster_priority_queue(
@@ -1215,13 +1225,12 @@ bool TileManager::MarkTilesOutOfMemory(
}
ResourceFormat TileManager::DetermineResourceFormat(const Tile* tile) const {
- return tile_task_manager_->GetRasterBufferProvider()->GetResourceFormat(
- !tile->is_opaque());
+ return raster_buffer_provider_->GetResourceFormat(!tile->is_opaque());
}
bool TileManager::DetermineResourceRequiresSwizzle(const Tile* tile) const {
- return tile_task_manager_->GetRasterBufferProvider()
- ->GetResourceRequiresSwizzle(!tile->is_opaque());
+ return raster_buffer_provider_->GetResourceRequiresSwizzle(
+ !tile->is_opaque());
}
std::unique_ptr<base::trace_event::ConvertableToTraceFormat>
« no previous file with comments | « cc/tiles/tile_manager.h ('k') | cc/tiles/tile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698