| 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 #include <set> | 10 #include <set> |
| (...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 // Check for a non-null active tree to avoid doing this during shutdown. | 1320 // Check for a non-null active tree to avoid doing this during shutdown. |
| 1321 if (active_tree_ && !client_->IsInsideDraw() && tile->required_for_draw()) { | 1321 if (active_tree_ && !client_->IsInsideDraw() && tile->required_for_draw()) { |
| 1322 // The LayerImpl::NotifyTileStateChanged() should damage the layer, so this | 1322 // The LayerImpl::NotifyTileStateChanged() should damage the layer, so this |
| 1323 // redraw will make those tiles be displayed. | 1323 // redraw will make those tiles be displayed. |
| 1324 SetNeedsRedraw(); | 1324 SetNeedsRedraw(); |
| 1325 } | 1325 } |
| 1326 } | 1326 } |
| 1327 | 1327 |
| 1328 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { | 1328 void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) { |
| 1329 SetManagedMemoryPolicy(policy); | 1329 SetManagedMemoryPolicy(policy); |
| 1330 |
| 1331 // This is short term solution to synchronously drop tile resources when |
| 1332 // using synchronous compositing to avoid memory usage regression. |
| 1333 // TODO(boliu): crbug.com/499004 to track removing this. |
| 1334 if (!policy.bytes_limit_when_visible && tile_manager_ && |
| 1335 settings_.using_synchronous_renderer_compositor) { |
| 1336 ReleaseTreeResources(); |
| 1337 // TileManager destruction will synchronoulsy wait for all tile workers to |
| 1338 // be cancelled or completed. This allows all resources to be freed |
| 1339 // synchronously. |
| 1340 DestroyTileManager(); |
| 1341 CreateAndSetTileManager(); |
| 1342 RecreateTreeResources(); |
| 1343 } |
| 1330 } | 1344 } |
| 1331 | 1345 |
| 1332 void LayerTreeHostImpl::SetTreeActivationCallback( | 1346 void LayerTreeHostImpl::SetTreeActivationCallback( |
| 1333 const base::Closure& callback) { | 1347 const base::Closure& callback) { |
| 1334 DCHECK(proxy_->IsImplThread()); | 1348 DCHECK(proxy_->IsImplThread()); |
| 1335 DCHECK(settings_.impl_side_painting || callback.is_null()); | 1349 DCHECK(settings_.impl_side_painting || callback.is_null()); |
| 1336 tree_activation_callback_ = callback; | 1350 tree_activation_callback_ = callback; |
| 1337 } | 1351 } |
| 1338 | 1352 |
| 1339 void LayerTreeHostImpl::SetManagedMemoryPolicy( | 1353 void LayerTreeHostImpl::SetManagedMemoryPolicy( |
| (...skipping 2143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3483 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 3497 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
| 3484 | 3498 |
| 3485 curve->UpdateTarget( | 3499 curve->UpdateTarget( |
| 3486 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) | 3500 animation->TrimTimeToCurrentIteration(CurrentBeginFrameArgs().frame_time) |
| 3487 .InSecondsF(), | 3501 .InSecondsF(), |
| 3488 new_target); | 3502 new_target); |
| 3489 | 3503 |
| 3490 return true; | 3504 return true; |
| 3491 } | 3505 } |
| 3492 } // namespace cc | 3506 } // namespace cc |
| OLD | NEW |