Index: ui/compositor/layer.cc |
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
index 9d00f20fa754873b6df2c552c09e5b85c97eac9f..6f2ac6c5b6a06c625c14d91316b7f104d99d4cf6 100644 |
--- a/ui/compositor/layer.cc |
+++ b/ui/compositor/layer.cc |
@@ -626,6 +626,7 @@ void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) { |
new_layer->SetTransform(cc_layer_->transform()); |
new_layer->SetPosition(cc_layer_->position()); |
new_layer->SetBackgroundColor(cc_layer_->background_color()); |
+ new_layer->SetCacheRenderSurface(cc_layer_->cache_render_surface()); |
cc_layer_ = new_layer.get(); |
content_layer_ = NULL; |
@@ -654,6 +655,15 @@ void Layer::SwitchCCLayerForTest() { |
content_layer_ = new_layer; |
} |
+// Note: The code that sets this flag would be responsible to unset it on that |
+// ui::Layer. We do not want to clone this flag to a cloned layer by accident, |
+// which could be a supprise. But we want to preserve it after switching to a |
+// new cc::Layer. There could be a whole subtree and the root changed, but does |
+// not mean we want to treat the cache all different. |
+void Layer::SetCacheRenderSurface(bool cache_render_surface) { |
+ cc_layer_->SetCacheRenderSurface(cache_render_surface); |
+} |
+ |
void Layer::SetTextureMailbox( |
const viz::TextureMailbox& mailbox, |
std::unique_ptr<viz::SingleReleaseCallback> release_callback, |