| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 void LayerTreeHostImpl::EvictTexturesForTesting() { | 1190 void LayerTreeHostImpl::EvictTexturesForTesting() { |
| 1191 UpdateTileManagerMemoryPolicy(ManagedMemoryPolicy(0)); | 1191 UpdateTileManagerMemoryPolicy(ManagedMemoryPolicy(0)); |
| 1192 } | 1192 } |
| 1193 | 1193 |
| 1194 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { | 1194 void LayerTreeHostImpl::BlockNotifyReadyToActivateForTesting(bool block) { |
| 1195 NOTREACHED(); | 1195 NOTREACHED(); |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 void LayerTreeHostImpl::ResetTreesForTesting() { | 1198 void LayerTreeHostImpl::ResetTreesForTesting() { |
| 1199 if (active_tree_) | 1199 if (active_tree_) |
| 1200 active_tree_->DetachLayerTree(); | 1200 active_tree_->ClearLayers(); |
| 1201 active_tree_ = | 1201 active_tree_ = |
| 1202 LayerTreeImpl::create(this, active_tree()->page_scale_factor(), | 1202 LayerTreeImpl::create(this, active_tree()->page_scale_factor(), |
| 1203 active_tree()->top_controls_shown_ratio(), | 1203 active_tree()->top_controls_shown_ratio(), |
| 1204 active_tree()->elastic_overscroll()); | 1204 active_tree()->elastic_overscroll()); |
| 1205 active_tree_->property_trees()->is_active = true; | 1205 active_tree_->property_trees()->is_active = true; |
| 1206 if (pending_tree_) | 1206 if (pending_tree_) |
| 1207 pending_tree_->DetachLayerTree(); | 1207 pending_tree_->ClearLayers(); |
| 1208 pending_tree_ = nullptr; | 1208 pending_tree_ = nullptr; |
| 1209 if (recycle_tree_) | 1209 if (recycle_tree_) |
| 1210 recycle_tree_->DetachLayerTree(); | 1210 recycle_tree_->ClearLayers(); |
| 1211 recycle_tree_ = nullptr; | 1211 recycle_tree_ = nullptr; |
| 1212 } | 1212 } |
| 1213 | 1213 |
| 1214 size_t LayerTreeHostImpl::SourceAnimationFrameNumberForTesting() const { | 1214 size_t LayerTreeHostImpl::SourceAnimationFrameNumberForTesting() const { |
| 1215 return fps_counter_->current_frame_number(); | 1215 return fps_counter_->current_frame_number(); |
| 1216 } | 1216 } |
| 1217 | 1217 |
| 1218 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( | 1218 void LayerTreeHostImpl::UpdateTileManagerMemoryPolicy( |
| 1219 const ManagedMemoryPolicy& policy) { | 1219 const ManagedMemoryPolicy& policy) { |
| 1220 if (!resource_pool_) | 1220 if (!resource_pool_) |
| (...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1950 void LayerTreeHostImpl::ActivateSyncTree() { | 1950 void LayerTreeHostImpl::ActivateSyncTree() { |
| 1951 if (pending_tree_) { | 1951 if (pending_tree_) { |
| 1952 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get()); | 1952 TRACE_EVENT_ASYNC_END0("cc", "PendingTree:waiting", pending_tree_.get()); |
| 1953 | 1953 |
| 1954 // Process any requests in the UI resource queue. The request queue is | 1954 // Process any requests in the UI resource queue. The request queue is |
| 1955 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place | 1955 // given in LayerTreeHost::FinishCommitOnImplThread. This must take place |
| 1956 // before the swap. | 1956 // before the swap. |
| 1957 pending_tree_->ProcessUIResourceRequestQueue(); | 1957 pending_tree_->ProcessUIResourceRequestQueue(); |
| 1958 | 1958 |
| 1959 if (pending_tree_->needs_full_tree_sync()) { | 1959 if (pending_tree_->needs_full_tree_sync()) { |
| 1960 active_tree_->SetRootLayer( | 1960 TreeSynchronizer::SynchronizeTrees(pending_tree_->root_layer(), |
| 1961 TreeSynchronizer::SynchronizeTrees(pending_tree_->root_layer(), | 1961 active_tree_.get()); |
| 1962 active_tree_->DetachLayerTree(), | |
| 1963 active_tree_.get())); | |
| 1964 } | 1962 } |
| 1963 |
| 1965 // We need to preserve the damage status of property trees on active tree. | 1964 // We need to preserve the damage status of property trees on active tree. |
| 1966 // We do this by pushing the damage status from active tree property trees | 1965 // We do this by pushing the damage status from active tree property trees |
| 1967 // to pending tree property trees. | 1966 // to pending tree property trees. |
| 1968 if (active_tree_->property_trees()->changed) { | 1967 if (active_tree_->property_trees()->changed) { |
| 1969 if (pending_tree_->property_trees()->sequence_number == | 1968 if (pending_tree_->property_trees()->sequence_number == |
| 1970 active_tree_->property_trees()->sequence_number) | 1969 active_tree_->property_trees()->sequence_number) |
| 1971 active_tree_->property_trees()->PushChangeTrackingTo( | 1970 active_tree_->property_trees()->PushChangeTrackingTo( |
| 1972 pending_tree_->property_trees()); | 1971 pending_tree_->property_trees()); |
| 1973 else | 1972 else |
| 1974 active_tree_->root_layer()->PushLayerPropertyChangedForSubtree(); | 1973 active_tree_->root_layer()->PushLayerPropertyChangedForSubtree(); |
| (...skipping 1947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3922 return task_runner_provider_->HasImplThread(); | 3921 return task_runner_provider_->HasImplThread(); |
| 3923 } | 3922 } |
| 3924 | 3923 |
| 3925 bool LayerTreeHostImpl::CommitToActiveTree() const { | 3924 bool LayerTreeHostImpl::CommitToActiveTree() const { |
| 3926 // In single threaded mode we skip the pending tree and commit directly to the | 3925 // In single threaded mode we skip the pending tree and commit directly to the |
| 3927 // active tree. | 3926 // active tree. |
| 3928 return !task_runner_provider_->HasImplThread(); | 3927 return !task_runner_provider_->HasImplThread(); |
| 3929 } | 3928 } |
| 3930 | 3929 |
| 3931 } // namespace cc | 3930 } // namespace cc |
| OLD | NEW |