Chromium Code Reviews| 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 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1169 settings_.max_memory_for_prepaint_percentage) / | 1169 settings_.max_memory_for_prepaint_percentage) / |
| 1170 100; | 1170 100; |
| 1171 } | 1171 } |
| 1172 global_tile_state_.memory_limit_policy = | 1172 global_tile_state_.memory_limit_policy = |
| 1173 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( | 1173 ManagedMemoryPolicy::PriorityCutoffToTileMemoryLimitPolicy( |
| 1174 visible_ ? | 1174 visible_ ? |
| 1175 policy.priority_cutoff_when_visible : | 1175 policy.priority_cutoff_when_visible : |
| 1176 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); | 1176 gpu::MemoryAllocation::CUTOFF_ALLOW_NOTHING); |
| 1177 global_tile_state_.num_resources_limit = policy.num_resources_limit; | 1177 global_tile_state_.num_resources_limit = policy.num_resources_limit; |
| 1178 | 1178 |
| 1179 if (use_gpu_rasterization_ && | |
|
vmiura
2015/04/02 19:12:34
nit: I think this would be easier to understand th
sohanjg
2015/04/08 09:00:31
Done.
| |
| 1180 (!visible_ || global_tile_state_.hard_memory_limit_in_bytes == 0)) { | |
| 1181 if (rasterizer_) | |
| 1182 rasterizer_->SetZeroMemoryLimit(); | |
| 1183 } | |
| 1184 | |
| 1185 if (use_gpu_rasterization_ && | |
| 1186 (visible_ && global_tile_state_.hard_memory_limit_in_bytes > 0)) { | |
| 1187 if (rasterizer_) | |
| 1188 rasterizer_->SetDefaultMemoryLimit(); | |
| 1189 } | |
| 1190 | |
| 1179 // TODO(reveman): We should avoid keeping around unused resources if | 1191 // TODO(reveman): We should avoid keeping around unused resources if |
| 1180 // possible. crbug.com/224475 | 1192 // possible. crbug.com/224475 |
| 1181 // Unused limit is calculated from soft-limit, as hard-limit may | 1193 // Unused limit is calculated from soft-limit, as hard-limit may |
| 1182 // be very high and shouldn't typically be exceeded. | 1194 // be very high and shouldn't typically be exceeded. |
| 1183 size_t unused_memory_limit_in_bytes = static_cast<size_t>( | 1195 size_t unused_memory_limit_in_bytes = static_cast<size_t>( |
| 1184 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * | 1196 (static_cast<int64>(global_tile_state_.soft_memory_limit_in_bytes) * |
| 1185 settings_.max_unused_resource_memory_percentage) / | 1197 settings_.max_unused_resource_memory_percentage) / |
| 1186 100); | 1198 100); |
| 1187 | 1199 |
| 1188 DCHECK(resource_pool_); | 1200 DCHECK(resource_pool_); |
| (...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3416 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3428 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3417 | 3429 |
| 3418 curve->UpdateTarget( | 3430 curve->UpdateTarget( |
| 3419 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3431 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3420 .InSecondsF(), | 3432 .InSecondsF(), |
| 3421 new_target); | 3433 new_target); |
| 3422 | 3434 |
| 3423 return true; | 3435 return true; |
| 3424 } | 3436 } |
| 3425 } // namespace cc | 3437 } // namespace cc |
| OLD | NEW |