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

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
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 651fe18ef032309174721e5c9aa0084f21937a26..fd825bbf04375251bd561743458c1aee9caafb8a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1239,14 +1239,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_);
@@ -1318,9 +1325,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 */);
+ }
}
}
@@ -2139,7 +2152,9 @@ void LayerTreeHostImpl::CreateTileManagerResources() {
CreateResourceAndTileTaskWorkerPool(&tile_task_worker_pool_, &resource_pool_);
if (use_gpu_rasterization_) {
- image_decode_controller_ = base::WrapUnique(new GpuImageDecodeController);
+ image_decode_controller_ = base::WrapUnique(new GpuImageDecodeController(
+ output_surface_->worker_context_provider(),
+ settings_.renderer_settings.preferred_tile_format));
} else {
image_decode_controller_ =
base::WrapUnique(new SoftwareImageDecodeController(
« no previous file with comments | « cc/tiles/tile_manager.cc ('k') | third_party/WebKit/LayoutTests/TestExpectations » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698