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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1832573004: Gpu Image Decode Controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 0e7a5806ea49ab893a3c7e271fa3207383a96ec7..1a99047296b6361dd875b15f63a4562c7f52fdea 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1238,14 +1238,21 @@ void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy(
gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
global_tile_state_.num_resources_limit = policy.num_resources_limit;
- if (output_surface_ && global_tile_state_.hard_memory_limit_in_bytes > 0) {
+ if (global_tile_state_.hard_memory_limit_in_bytes > 0) {
// If |global_tile_state_.hard_memory_limit_in_bytes| is greater than 0, we
- // allow the worker context to retain allocated resources. Notify the worker
- // context. If the memory policy has become zero, we'll handle the
- // notification in NotifyAllTileTasksCompleted, after in-progress work
- // finishes.
- output_surface_->SetWorkerContextShouldAggressivelyFreeResources(
- false /* aggressively_free_resources */);
+ // allow the worker context and image decode controller to retain allocated
+ // resources. Notify them here. If the memory policy has become zero, we'll
+ // handle the notification in NotifyAllTileTasksCompleted, after
+ // in-progress work finishes.
+ if (output_surface_) {
+ output_surface_->SetWorkerContextShouldAggressivelyFreeResources(
+ false /* aggressively_free_resources */);
+ }
+
+ if (image_decode_controller_) {
+ image_decode_controller_->SetShouldAggressivelyFreeResources(
+ false /* aggressively_free_resources */);
+ }
}
DCHECK(resource_pool_);
@@ -1316,9 +1323,15 @@ void LayerTreeHostImpl::NotifyReadyToDraw() {
void LayerTreeHostImpl::NotifyAllTileTasksCompleted() {
// The tile tasks started by the most recent call to PrepareTiles have
// completed. Now is a good time to free resources if necessary.
- if (output_surface_ && global_tile_state_.hard_memory_limit_in_bytes == 0) {
- output_surface_->SetWorkerContextShouldAggressivelyFreeResources(
- true /* aggressively_free_resources */);
+ if (global_tile_state_.hard_memory_limit_in_bytes == 0) {
+ if (output_surface_) {
+ output_surface_->SetWorkerContextShouldAggressivelyFreeResources(
+ true /* aggressively_free_resources */);
+ }
+ if (image_decode_controller_) {
+ image_decode_controller_->SetShouldAggressivelyFreeResources(
+ true /* aggressively_free_resources */);
+ }
}
}
@@ -2137,7 +2150,9 @@ void LayerTreeHostImpl::CreateTileManagerResources() {
CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_);
if (use_gpu_rasterization_) {
- image_decode_controller_ = make_scoped_ptr(new GpuImageDecodeController);
+ image_decode_controller_ = make_scoped_ptr(new GpuImageDecodeController(
+ output_surface_->worker_context_provider(),
+ settings_.renderer_settings.preferred_tile_format));
} else {
image_decode_controller_ =
make_scoped_ptr(new SoftwareImageDecodeController(

Powered by Google App Engine
This is Rietveld 408576698