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

Unified Diff: cc/layer_tree_impl.cc

Issue 11575018: cc: Add id->LayerImpl map to LayerTreeImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/layer_tree_impl.cc
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc
index d434bb0e6a2a4f78f1706fa3740720224f8bc1d0..a113316c77b3dc79bac020ad0c65d8b3af0df422 100644
--- a/cc/layer_tree_impl.cc
+++ b/cc/layer_tree_impl.cc
@@ -19,6 +19,9 @@ LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl)
}
LayerTreeImpl::~LayerTreeImpl() {
+ // Need to explicitly clear the tree prior to destroying this so that
+ // the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
+ root_layer_.reset();
}
static LayerImpl* findRootScrollLayer(LayerImpl* layer)
@@ -68,6 +71,21 @@ void LayerTreeImpl::ClearCurrentlyScrollingLayer() {
scrolling_layer_id_from_previous_tree_ = 0;
}
+LayerImpl* LayerTreeImpl::LayerById(int id) {
+ LayerIdMap::iterator iter = layer_id_map_.find(id);
+ return iter != layer_id_map_.end() ? iter->second : NULL;
+}
+
+void LayerTreeImpl::RegisterLayer(LayerImpl* layer) {
+ DCHECK(!LayerById(layer->id()));
+ layer_id_map_[layer->id()] = layer;
+}
+
+void LayerTreeImpl::UnregisterLayer(LayerImpl* layer) {
+ DCHECK(LayerById(layer->id()));
+ layer_id_map_.erase(layer->id());
+}
+
const LayerTreeSettings& LayerTreeImpl::settings() const {
return layer_tree_host_impl_->settings();
}
« cc/layer_tree_impl.h ('K') | « cc/layer_tree_impl.h ('k') | cc/quad_culler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698