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 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 settings_.max_memory_for_prepaint_percentage) / | 1178 settings_.max_memory_for_prepaint_percentage) / |
1179 100; | 1179 100; |
1180 } | 1180 } |
1181 global_tile_state_.memory_limit_policy = | 1181 global_tile_state_.memory_limit_policy = |
1182 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( | 1182 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( |
1183 visible_ ? | 1183 visible_ ? |
1184 policy.priority_cutoff_when_visible : | 1184 policy.priority_cutoff_when_visible : |
1185 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); | 1185 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); |
1186 global_tile_state_.num_resources_limit = policy.num_resources_limit; | 1186 global_tile_state_.num_resources_limit = policy.num_resources_limit; |
1187 | 1187 |
| 1188 if (use_gpu_rasterization_ && resource_provider_ && |
| 1189 (!visible_ || global_tile_state_.hard_memory_limit_in_bytes == 0)) |
| 1190 resource_provider_->FreeGrResources(); |
| 1191 |
1188 // TODO(reveman): We should avoid keeping around unused resources if | 1192 // TODO(reveman): We should avoid keeping around unused resources if |
1189 // possible. crbug.com/224475 | 1193 // possible. crbug.com/224475 |
1190 // Unused limit is calculated from soft-limit, as hard-limit may | 1194 // Unused limit is calculated from soft-limit, as hard-limit may |
1191 // be very high and shouldn't typically be exceeded. | 1195 // be very high and shouldn't typically be exceeded. |
1192 size_t unused_memory_limit_in_bytes = static_cast<size_t>( | 1196 size_t unused_memory_limit_in_bytes = static_cast<size_t>( |
1193 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * | 1197 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * |
1194 settings_.max_unused_resource_memory_percentage) / | 1198 settings_.max_unused_resource_memory_percentage) / |
1195 100); | 1199 100); |
1196 | 1200 |
1197 DCHECK(resource_pool_); | 1201 DCHECK(resource_pool_); |
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3430 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3434 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
3431 | 3435 |
3432 curve->UpdateTarget( | 3436 curve->UpdateTarget( |
3433 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3437 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
3434 .InSecondsF(), | 3438 .InSecondsF(), |
3435 new_target); | 3439 new_target); |
3436 | 3440 |
3437 return true; | 3441 return true; |
3438 } | 3442 } |
3439 } // namespace cc | 3443 } // namespace cc |
OLD | NEW |