| Index: cc/trees/layer_tree_host_impl.cc
|
| diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
|
| index 8050377440ffb539d1b56570176a9c2e6dcad118..bbdd0241a25a0519de268db2e17384c0754ddc4b 100644
|
| --- a/cc/trees/layer_tree_host_impl.cc
|
| +++ b/cc/trees/layer_tree_host_impl.cc
|
| @@ -1244,7 +1244,8 @@ void LayerTreeHostImpl::DidInitializeVisibleTile() {
|
| client_->DidInitializeVisibleTileOnImplThread();
|
| }
|
|
|
| -const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() {
|
| +const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers()
|
| + const {
|
| return picture_layers_;
|
| }
|
|
|
| @@ -1270,6 +1271,26 @@ void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) {
|
| }
|
| }
|
|
|
| +TilePriorityQueue* LayerTreeHostImpl::RebuildRasterQueue(
|
| + TreePriority tree_priority) {
|
| + // TODO(vmpstr): Investigate if we can skip preparation if nothing changed
|
| + // (priorities, etc)
|
| + std::vector<PairedPictureLayer> paired_layers;
|
| + GetPairedPictureLayers(&paired_layers);
|
| + raster_queue_.Prepare(paired_layers, tree_priority);
|
| + return &raster_queue_;
|
| +}
|
| +
|
| +TilePriorityQueue* LayerTreeHostImpl::RebuildEvictionQueue(
|
| + TreePriority tree_priority) {
|
| + // TODO(vmpstr): Investigate if we can skip preparation if nothing changed
|
| + // (priorities, etc)
|
| + std::vector<PairedPictureLayer> paired_layers;
|
| + GetPairedPictureLayers(&paired_layers);
|
| + eviction_queue_.Prepare(paired_layers, tree_priority);
|
| + return &eviction_queue_;
|
| +}
|
| +
|
| void LayerTreeHostImpl::SetMemoryPolicy(const ManagedMemoryPolicy& policy) {
|
| SetManagedMemoryPolicy(policy, zero_budget_);
|
| }
|
| @@ -1997,6 +2018,49 @@ void LayerTreeHostImpl::EnforceZeroBudget(bool zero_budget) {
|
| SetManagedMemoryPolicy(cached_managed_memory_policy_, zero_budget);
|
| }
|
|
|
| +void LayerTreeHostImpl::GetPairedPictureLayers(
|
| + std::vector<PairedPictureLayer>* paired_layers) const {
|
| + const std::vector<PictureLayerImpl*>& layers = GetPictureLayers();
|
| +
|
| + paired_layers->clear();
|
| + // Reserve a maximum possible paired layers.
|
| + paired_layers->reserve(layers.size());
|
| +
|
| + for (std::vector<PictureLayerImpl*>::const_iterator it = layers.begin();
|
| + it != layers.end();
|
| + ++it) {
|
| + PictureLayerImpl* layer = *it;
|
| +
|
| + // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704
|
| + if (!layer->HasValidTilePriorities())
|
| + continue;
|
| +
|
| + PictureLayerImpl* twin_layer = layer->GetTwinLayer();
|
| +
|
| + // Ignore the twin layer when tile priorities are invalid.
|
| + // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704
|
| + if (twin_layer && !twin_layer->HasValidTilePriorities())
|
| + twin_layer = NULL;
|
| +
|
| + PairedPictureLayer paired_layer;
|
| + WhichTree tree = layer->GetTree();
|
| +
|
| + // If the current tree is ACTIVE_TREE, then always generate a paired_layer.
|
| + // If current tree is PENDING_TREE, then only generate a paired_layer if
|
| + // there is no twin layer.
|
| + if (tree == ACTIVE_TREE) {
|
| + DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE);
|
| + paired_layer.active_layer = layer;
|
| + paired_layer.pending_layer = twin_layer;
|
| + paired_layers->push_back(paired_layer);
|
| + } else if (!twin_layer) {
|
| + paired_layer.active_layer = NULL;
|
| + paired_layer.pending_layer = layer;
|
| + paired_layers->push_back(paired_layer);
|
| + }
|
| + }
|
| +}
|
| +
|
| bool LayerTreeHostImpl::InitializeRenderer(
|
| scoped_ptr<OutputSurface> output_surface) {
|
| TRACE_EVENT0("cc", "LayerTreeHostImpl::InitializeRenderer");
|
|
|