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

Side by Side Diff: cc/trees/layer_tree_host_impl.cc

Issue 1016733002: cc: Free gpu resources when we are invisible or TM is oom. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed. Created 5 years, 9 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/layer_tree_host_impl.h" 5 #include "cc/trees/layer_tree_host_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after
1162 settings_.max_memory_for_prepaint_percentage) / 1162 settings_.max_memory_for_prepaint_percentage) /
1163 100; 1163 100;
1164 } 1164 }
1165 global_tile_state_.memory_limit_policy = 1165 global_tile_state_.memory_limit_policy =
1166 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( 1166 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy(
1167 visible_ ? 1167 visible_ ?
1168 policy.priority_cutoff_when_visible : 1168 policy.priority_cutoff_when_visible :
1169 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); 1169 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING);
1170 global_tile_state_.num_resources_limit = policy.num_resources_limit; 1170 global_tile_state_.num_resources_limit = policy.num_resources_limit;
1171 1171
1172 if (use_gpu_rasterization_ &&
1173 (!visible_ || global_tile_state_.hard_memory_limit_in_bytes == 0)) {
1174 if (rasterizer_)
1175 rasterizer_->ClearCache();
1176 }
1177
1172 // TODO(reveman): We should avoid keeping around unused resources if 1178 // TODO(reveman): We should avoid keeping around unused resources if
1173 // possible. crbug.com/224475 1179 // possible. crbug.com/224475
1174 // Unused limit is calculated from soft-limit, as hard-limit may 1180 // Unused limit is calculated from soft-limit, as hard-limit may
1175 // be very high and shouldn't typically be exceeded. 1181 // be very high and shouldn't typically be exceeded.
1176 size_t unused_memory_limit_in_bytes = static_cast<size_t>( 1182 size_t unused_memory_limit_in_bytes = static_cast<size_t>(
1177 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * 1183 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) *
1178 settings_.max_unused_resource_memory_percentage) / 1184 settings_.max_unused_resource_memory_percentage) /
1179 100); 1185 100);
1180 1186
1181 DCHECK(resource_pool_); 1187 DCHECK(resource_pool_);
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
3453 (*it)->OnSetNeedsRedrawOnImpl(); 3459 (*it)->OnSetNeedsRedrawOnImpl();
3454 } 3460 }
3455 3461
3456 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { 3462 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() {
3457 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); 3463 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin();
3458 for (; it != swap_promise_monitor_.end(); it++) 3464 for (; it != swap_promise_monitor_.end(); it++)
3459 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); 3465 (*it)->OnForwardScrollUpdateToMainThreadOnImpl();
3460 } 3466 }
3461 3467
3462 } // namespace cc 3468 } // namespace cc
OLDNEW
« cc/resources/gpu_rasterizer.cc ('K') | « cc/resources/software_rasterizer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698