Index: cc/layer_tree_impl.cc |
diff --git a/cc/layer_tree_impl.cc b/cc/layer_tree_impl.cc |
index de4bfa166829bb2816cf3ef3dc1a1b4d6e2e856b..949cf84769e153cf8a8a7e90a0788041f2688817 100644 |
--- a/cc/layer_tree_impl.cc |
+++ b/cc/layer_tree_impl.cc |
@@ -4,6 +4,7 @@ |
#include "cc/layer_tree_impl.h" |
+#include "base/debug/trace_event.h" |
#include "cc/layer_tree_host_common.h" |
#include "cc/layer_tree_host_impl.h" |
#include "ui/gfx/vector2d_conversions.h" |
@@ -64,6 +65,8 @@ scoped_ptr<LayerImpl> LayerTreeImpl::DetachLayerTree() { |
currently_scrolling_layer_ ? currently_scrolling_layer_->id() : 0; |
currently_scrolling_layer_ = NULL; |
+ render_surface_layer_list_.clear(); |
+ SetNeedsUpdateDrawProperties(); |
return root_layer_.Pass(); |
} |
@@ -106,6 +109,49 @@ void LayerTreeImpl::UpdateMaxScrollOffset() { |
root_scroll_layer()->setMaxScrollOffset(gfx::ToFlooredVector2d(max_scroll)); |
} |
+void LayerTreeImpl::UpdateDrawProperties() { |
+ render_surface_layer_list_.clear(); |
+ if (!RootLayer()) |
+ return; |
+ |
+ if (root_scroll_layer()) { |
+ root_scroll_layer()->setImplTransform( |
+ layer_tree_host_impl_->implTransform()); |
+ } |
+ |
+ { |
+ TRACE_EVENT0("cc", "LayerTreeImpl::UpdateDrawProperties"); |
+ LayerTreeHostCommon::calculateDrawProperties( |
+ RootLayer(), |
+ device_viewport_size(), |
+ device_scale_factor(), |
+ pinch_zoom_viewport().pageScaleFactor(), |
+ layer_tree_host_impl_->rendererCapabilities().maxTextureSize, |
+ settings().canUseLCDText, |
+ render_surface_layer_list_); |
+ } |
+} |
+ |
+static void ClearRenderSurfacesOnLayerImplRecursive(LayerImpl* current) |
+{ |
+ DCHECK(current); |
+ for (size_t i = 0; i < current->children().size(); ++i) |
+ ClearRenderSurfacesOnLayerImplRecursive(current->children()[i]); |
+ current->clearRenderSurface(); |
+} |
+ |
+void LayerTreeImpl::ClearRenderSurfaces() { |
+ ClearRenderSurfacesOnLayerImplRecursive(RootLayer()); |
+ render_surface_layer_list_.clear(); |
+ SetNeedsUpdateDrawProperties(); |
+} |
+ |
+const LayerTreeImpl::LayerList& LayerTreeImpl::RenderSurfaceLayerList() const { |
+ // If this assert triggers, then the list is dirty. |
+ DCHECK(!layer_tree_host_impl_->needsUpdateDrawProperties()); |
+ return render_surface_layer_list_; |
+} |
+ |
gfx::Size LayerTreeImpl::ContentSize() const { |
// TODO(aelias): Hardcoding the first child here is weird. Think of |
// a cleaner way to get the contentBounds on the Impl side. |