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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
9 #include "cc/layer_tree_host_impl.h" | 9 #include "cc/layer_tree_host_impl.h" |
10 #include "ui/gfx/vector2d_conversions.h" | 10 #include "ui/gfx/vector2d_conversions.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) | 14 LayerTreeImpl::LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl) |
15 : layer_tree_host_impl_(layer_tree_host_impl) | 15 : layer_tree_host_impl_(layer_tree_host_impl) |
16 , source_frame_number_(-1) | 16 , source_frame_number_(-1) |
17 , hud_layer_(0) | 17 , hud_layer_(0) |
18 , root_scroll_layer_(0) | 18 , root_scroll_layer_(0) |
19 , currently_scrolling_layer_(0) | 19 , currently_scrolling_layer_(0) |
20 , background_color_(0) | 20 , background_color_(0) |
21 , has_transparent_background_(false) | 21 , has_transparent_background_(false) |
22 , scrolling_layer_id_from_previous_tree_(0) { | 22 , scrolling_layer_id_from_previous_tree_(0) |
| 23 , contents_textures_purged_(false) { |
23 } | 24 } |
24 | 25 |
25 LayerTreeImpl::~LayerTreeImpl() { | 26 LayerTreeImpl::~LayerTreeImpl() { |
26 // Need to explicitly clear the tree prior to destroying this so that | 27 // Need to explicitly clear the tree prior to destroying this so that |
27 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. | 28 // the LayerTreeImpl pointer is still valid in the LayerImpl dtor. |
28 root_layer_.reset(); | 29 root_layer_.reset(); |
29 } | 30 } |
30 | 31 |
31 static LayerImpl* findRootScrollLayer(LayerImpl* layer) | 32 static LayerImpl* findRootScrollLayer(LayerImpl* layer) |
32 { | 33 { |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 layer->didBecomeActive(); | 209 layer->didBecomeActive(); |
209 for (size_t i = 0; i < layer->children().size(); ++i) | 210 for (size_t i = 0; i < layer->children().size(); ++i) |
210 DidBecomeActiveRecursive(layer->children()[i]); | 211 DidBecomeActiveRecursive(layer->children()[i]); |
211 } | 212 } |
212 | 213 |
213 void LayerTreeImpl::DidBecomeActive() { | 214 void LayerTreeImpl::DidBecomeActive() { |
214 if (RootLayer()) | 215 if (RootLayer()) |
215 DidBecomeActiveRecursive(RootLayer()); | 216 DidBecomeActiveRecursive(RootLayer()); |
216 } | 217 } |
217 | 218 |
| 219 bool LayerTreeImpl::ContentsTexturesPurged() const { |
| 220 return contents_textures_purged_; |
| 221 } |
| 222 |
| 223 void LayerTreeImpl::SetContentsTexturesPurged() { |
| 224 contents_textures_purged_ = true; |
| 225 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 226 } |
| 227 |
| 228 void LayerTreeImpl::ResetContentsTexturesPurged() { |
| 229 contents_textures_purged_ = false; |
| 230 layer_tree_host_impl_->OnCanDrawStateChangedForTree(this); |
| 231 } |
| 232 |
218 const LayerTreeSettings& LayerTreeImpl::settings() const { | 233 const LayerTreeSettings& LayerTreeImpl::settings() const { |
219 return layer_tree_host_impl_->settings(); | 234 return layer_tree_host_impl_->settings(); |
220 } | 235 } |
221 | 236 |
222 OutputSurface* LayerTreeImpl::output_surface() const { | 237 OutputSurface* LayerTreeImpl::output_surface() const { |
223 return layer_tree_host_impl_->outputSurface(); | 238 return layer_tree_host_impl_->outputSurface(); |
224 } | 239 } |
225 | 240 |
226 ResourceProvider* LayerTreeImpl::resource_provider() const { | 241 ResourceProvider* LayerTreeImpl::resource_provider() const { |
227 return layer_tree_host_impl_->resourceProvider(); | 242 return layer_tree_host_impl_->resourceProvider(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 314 |
300 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { | 315 AnimationRegistrar* LayerTreeImpl::animationRegistrar() const { |
301 return layer_tree_host_impl_->animationRegistrar(); | 316 return layer_tree_host_impl_->animationRegistrar(); |
302 } | 317 } |
303 | 318 |
304 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { | 319 const PinchZoomViewport& LayerTreeImpl::pinch_zoom_viewport() const { |
305 return layer_tree_host_impl_->pinchZoomViewport(); | 320 return layer_tree_host_impl_->pinchZoomViewport(); |
306 } | 321 } |
307 | 322 |
308 } // namespace cc | 323 } // namespace cc |
OLD | NEW |