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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 406543003: cc: Change TileManager iterators to be queues. (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
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 a2c8111e0e7329d569bb383dafb1b65c3b6cdfea..322cc15c74ea98921891b3dbd2529b04a9ae5c9a 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -45,6 +45,7 @@
#include "cc/quads/shared_quad_state.h"
#include "cc/quads/solid_color_draw_quad.h"
#include "cc/quads/texture_draw_quad.h"
+#include "cc/resources/eviction_tile_priority_queue.h"
#include "cc/resources/gpu_raster_worker_pool.h"
#include "cc/resources/image_copy_raster_worker_pool.h"
#include "cc/resources/image_raster_worker_pool.h"
@@ -52,6 +53,7 @@
#include "cc/resources/picture_layer_tiling.h"
#include "cc/resources/pixel_buffer_raster_worker_pool.h"
#include "cc/resources/prioritized_resource_manager.h"
+#include "cc/resources/raster_tile_priority_queue.h"
#include "cc/resources/raster_worker_pool.h"
#include "cc/resources/resource_pool.h"
#include "cc/resources/texture_mailbox_deleter.h"
@@ -1246,7 +1248,64 @@ void LayerTreeHostImpl::DidInitializeVisibleTile() {
client_->DidInitializeVisibleTileOnImplThread();
}
-const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() {
+void LayerTreeHostImpl::GetPictureLayerImplPairs(
+ std::vector<PictureLayerImpl::Pair>* layer_pairs) const {
+ layer_pairs->clear();
reveman 2014/07/19 00:45:50 Let's make this the responsibility of the caller i
vmpstr 2014/07/20 01:15:04 Done.
+ // Reserve a maximum possible paired layers.
+ layer_pairs->reserve(picture_layers_.size());
reveman 2014/07/19 00:45:50 Please have the caller reuse the same vector inste
vmpstr 2014/07/20 01:15:04 Done.
+
+ for (std::vector<PictureLayerImpl*>::const_iterator it =
+ picture_layers_.begin();
+ it != picture_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;
+
+ PictureLayerImpl::Pair layer_pair;
reveman 2014/07/19 00:45:50 This temporary variable seem unnecessary. How abou
vmpstr 2014/07/20 01:15:04 Done.
+ WhichTree tree = layer->GetTree();
reveman 2014/07/19 00:45:50 this temporary variable seem unnecessary too
vmpstr 2014/07/20 01:15:04 Done.
+
+ // If the current tree is ACTIVE_TREE, then always generate a layer_pair.
+ // If current tree is PENDING_TREE, then only generate a layer_pair if
+ // there is no twin layer.
+ if (tree == ACTIVE_TREE) {
+ DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE);
+ layer_pair.active = layer;
+ layer_pair.pending = twin_layer;
+ layer_pairs->push_back(layer_pair);
+ } else if (!twin_layer) {
+ layer_pair.active = NULL;
+ layer_pair.pending = layer;
+ layer_pairs->push_back(layer_pair);
+ }
+ }
+}
+
+void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue,
+ TreePriority tree_priority) {
+ std::vector<PictureLayerImpl::Pair> layer_pairs;
+ GetPictureLayerImplPairs(&layer_pairs);
+ queue->Build(layer_pairs, tree_priority);
+}
+
+void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue,
+ TreePriority tree_priority) {
+ std::vector<PictureLayerImpl::Pair> layer_pairs;
+ GetPictureLayerImplPairs(&layer_pairs);
+ queue->Build(layer_pairs, tree_priority);
+}
+
+const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers()
+ const {
return picture_layers_;
}

Powered by Google App Engine
This is Rietveld 408576698