OLD | NEW |
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 Loading... |
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 |
| 1178 if (use_gpu_rasterization_ && |
| 1179 (visible_ && global_tile_state_.hard_memory_limit_in_bytes > 0)) { |
| 1180 if (rasterizer_) |
| 1181 rasterizer_->RestoreCacheLimits(); |
| 1182 } |
| 1183 |
1172 // TODO(reveman): We should avoid keeping around unused resources if | 1184 // TODO(reveman): We should avoid keeping around unused resources if |
1173 // possible. crbug.com/224475 | 1185 // possible. crbug.com/224475 |
1174 // Unused limit is calculated from soft-limit, as hard-limit may | 1186 // Unused limit is calculated from soft-limit, as hard-limit may |
1175 // be very high and shouldn't typically be exceeded. | 1187 // be very high and shouldn't typically be exceeded. |
1176 size_t unused_memory_limit_in_bytes = static_cast<size_t>( | 1188 size_t unused_memory_limit_in_bytes = static_cast<size_t>( |
1177 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * | 1189 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * |
1178 settings_.max_unused_resource_memory_percentage) / | 1190 settings_.max_unused_resource_memory_percentage) / |
1179 100); | 1191 100); |
1180 | 1192 |
1181 DCHECK(resource_pool_); | 1193 DCHECK(resource_pool_); |
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3453 (*it)->OnSetNeedsRedrawOnImpl(); | 3465 (*it)->OnSetNeedsRedrawOnImpl(); |
3454 } | 3466 } |
3455 | 3467 |
3456 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { | 3468 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfForwardingToMainThread() { |
3457 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3469 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3458 for (; it != swap_promise_monitor_.end(); it++) | 3470 for (; it != swap_promise_monitor_.end(); it++) |
3459 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); | 3471 (*it)->OnForwardScrollUpdateToMainThreadOnImpl(); |
3460 } | 3472 } |
3461 | 3473 |
3462 } // namespace cc | 3474 } // namespace cc |
OLD | NEW |