| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "cc/layer_tree_impl.h" | 5 #include "cc/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include "cc/layer_tree_host_common.h" | 7 #include "cc/layer_tree_host_common.h" |
| 8 #include "cc/layer_tree_host_impl.h" | 8 #include "cc/layer_tree_host_impl.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| 11 | 11 |
| 12 LayerTreeImpl::LayerTreeImpl(LayerTreeImplClient* client) | 12 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
| 13 : client_(client) | 13 : layer_tree_host_impl_(layer_tree_host_impl) |
| 14 , source_frame_number_(-1) | 14 , source_frame_number_(-1) |
| 15 , hud_layer_(0) | 15 , hud_layer_(0) |
| 16 , root_scroll_layer_(0) | 16 , root_scroll_layer_(0) |
| 17 , currently_scrolling_layer_(0) | 17 , currently_scrolling_layer_(0) |
| 18 , scrolling_layer_id_from_previous_tree_(0) { | 18 , scrolling_layer_id_from_previous_tree_(0) { |
| 19 } | 19 } |
| 20 | 20 |
| 21 LayerTreeImpl::~LayerTreeImpl() { | 21 LayerTreeImpl::~LayerTreeImpl() { |
| 22 } | 22 } |
| 23 | 23 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 44 currently_scrolling_layer_ = 0; | 44 currently_scrolling_layer_ = 0; |
| 45 | 45 |
| 46 if (root_layer_ && scrolling_layer_id_from_previous_tree_) { | 46 if (root_layer_ && scrolling_layer_id_from_previous_tree_) { |
| 47 currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree( | 47 currently_scrolling_layer_ = LayerTreeHostCommon::findLayerInSubtree( |
| 48 root_layer_.get(), | 48 root_layer_.get(), |
| 49 scrolling_layer_id_from_previous_tree_); | 49 scrolling_layer_id_from_previous_tree_); |
| 50 } | 50 } |
| 51 | 51 |
| 52 scrolling_layer_id_from_previous_tree_ = 0; | 52 scrolling_layer_id_from_previous_tree_ = 0; |
| 53 | 53 |
| 54 client_->OnCanDrawStateChangedForTree(this); | 54 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 55 } | 55 } |
| 56 | 56 |
| 57 scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { | 57 scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { |
| 58 // Clear all data structures that have direct references to the layer tree. | 58 // Clear all data structures that have direct references to the layer tree. |
| 59 scrolling_layer_id_from_previous_tree_ = | 59 scrolling_layer_id_from_previous_tree_ = |
| 60 currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; | 60 currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
| 61 currently_scrolling_layer_ = NULL; | 61 currently_scrolling_layer_ = NULL; |
| 62 | 62 |
| 63 return root_layer_.Pass(); | 63 return root_layer_.Pass(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { | 66 void LayerTreeImpl::ClearCurrentlyScrollingLayer() { |
| 67 currently_scrolling_layer_ = NULL; | 67 currently_scrolling_layer_ = NULL; |
| 68 scrolling_layer_id_from_previous_tree_ = 0; | 68 scrolling_layer_id_from_previous_tree_ = 0; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace cc | 71 } // namespace cc |
| OLD | NEW |