Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3012)

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 367833003: cc: Start using raster/eviction iterators. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« cc/resources/tile_priority_queue.h ('K') | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 de1e8ffcacd26e2befe65d392552ba699e0a7b75..7189773c2b81d85f442657b46498f3fd32001803 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -1223,7 +1223,8 @@ void LayerTreeHostImpl::DidInitializeVisibleTile() {
client_->DidInitializeVisibleTileOnImplThread();
}
-const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() {
+const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers()
+ const {
return picture_layers_;
}
@@ -1249,6 +1250,25 @@ void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) {
}
}
+RasterTileQueue* LayerTreeHostImpl::GetRasterQueue(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);
reveman 2014/07/09 02:21:09 I don't think we should use a client function to t
vmpstr 2014/07/09 18:35:38 Calling prepare in tile manager seems like a wrong
+ return &raster_queue_;
+}
+
+EvictionTileQueue* LayerTreeHostImpl::GetEvictionQueue(
+ 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_);
}
@@ -1974,6 +1994,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");
« cc/resources/tile_priority_queue.h ('K') | « cc/trees/layer_tree_host_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698