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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2051013002: cc : Push layer lists instead of layer tree at commit and activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 901bba6175af8ffa1d92ac9e1d84987840ffa00d..56d1f5d212331105dd47fbd27d6250a708e0b9c0 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -261,11 +261,24 @@ void LayerTreeImpl::SetRootLayer(std::unique_ptr<LayerImpl> layer) {
layer_tree_host_impl_->OnCanDrawStateChangedForTree();
}
-void LayerTreeImpl::BuildLayerListForTesting() {
+void LayerTreeImpl::SetRootLayerFromLayerList() {
jaydasika 2016/06/09 05:07:54 This needs better name! root_layer_ should ultimat
+ root_layer_ = layer_list_.empty() ? nullptr : layer_list_[0];
+ layer_tree_host_impl_->OnCanDrawStateChangedForTree();
+}
+
+void LayerTreeImpl::AddToLayerList(LayerImpl* layer) {
+ layer_list_.push_back(layer);
+}
+
+void LayerTreeImpl::ClearLayerList() {
layer_list_.clear();
+}
+
+void LayerTreeImpl::BuildLayerListForTesting() {
+ ClearLayerList();
LayerListIterator<LayerImpl> it(root_layer_);
for (; it != LayerListIterator<LayerImpl>(nullptr); ++it) {
- layer_list_.push_back(*it);
+ AddToLayerList(*it);
}
}
@@ -307,6 +320,7 @@ gfx::ScrollOffset LayerTreeImpl::TotalMaxScrollOffset() const {
std::unique_ptr<OwnedLayerImplList> LayerTreeImpl::DetachLayers() {
root_layer_ = nullptr;
+ layer_list_.clear();
render_surface_layer_list_.clear();
set_needs_update_draw_properties();
std::unique_ptr<OwnedLayerImplList> ret = std::move(layers_);
@@ -444,20 +458,20 @@ void LayerTreeImpl::MoveChangeTrackingToLayers() {
}
}
-LayerListIterator<LayerImpl> LayerTreeImpl::begin() const {
- return LayerListIterator<LayerImpl>(root_layer_);
+std::vector<LayerImpl*>::const_iterator LayerTreeImpl::begin() const {
+ return layer_list_.cbegin();
}
-LayerListIterator<LayerImpl> LayerTreeImpl::end() const {
- return LayerListIterator<LayerImpl>(nullptr);
+std::vector<LayerImpl*>::const_iterator LayerTreeImpl::end() const {
+ return layer_list_.cend();
}
-LayerListReverseIterator<LayerImpl> LayerTreeImpl::rbegin() {
- return LayerListReverseIterator<LayerImpl>(root_layer_);
+std::vector<LayerImpl*>::reverse_iterator LayerTreeImpl::rbegin() {
+ return layer_list_.rbegin();
}
-LayerListReverseIterator<LayerImpl> LayerTreeImpl::rend() {
- return LayerListReverseIterator<LayerImpl>(nullptr);
+std::vector<LayerImpl*>::reverse_iterator LayerTreeImpl::rend() {
+ return layer_list_.rend();
}
void LayerTreeImpl::AddToElementMap(LayerImpl* layer) {

Powered by Google App Engine
This is Rietveld 408576698