Index: ui/compositor/layer.cc |
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc |
index bbca75ab9628ca599cd35c36740f9d8af19a39bb..2e2f6500cffdab237f02780d1d0ca50f8bc59b0b 100644 |
--- a/ui/compositor/layer.cc |
+++ b/ui/compositor/layer.cc |
@@ -10,6 +10,7 @@ |
#include "base/debug/trace_event.h" |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
+#include "cc/transferable_resource.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSupport.h" |
#include "third_party/WebKit/Source/Platform/chromium/public/WebContentLayer.h" |
@@ -423,6 +424,50 @@ void Layer::SetExternalTexture(Texture* texture) { |
RecomputeDrawsContentAndUVRect(); |
} |
+void Layer::SetCompositorFrame(const WebKit::WebCompositorFrame& frame) { |
+ DCHECK_EQ(type_, LAYER_TEXTURED); |
+ layer_updated_externally_ = false; |
+ if (!delegated_renderer_layer_.get()) { |
+ // Switch to a different type of layer. |
+ web_layer_->removeAllChildren(); |
+ scoped_ptr<WebKit::WebContentLayer> old_content_layer( |
+ content_layer_.release()); |
+ scoped_ptr<WebKit::WebSolidColorLayer> old_solid_layer( |
+ solid_color_layer_.release()); |
+ scoped_ptr<WebKit::WebExternalTextureLayer> old_texture_layer( |
+ texture_layer_.release()); |
+ WebKit::WebLayer* new_layer = NULL; |
+ WebKit::WebCompositorSupport* compositor_support = |
+ WebKit::Platform::current()->compositorSupport(); |
+ delegated_renderer_layer_.reset( |
+ compositor_support->createDelegatedRendererLayer()); |
+ new_layer = delegated_renderer_layer_->layer(); |
+ if (parent_) { |
+ DCHECK(parent_->web_layer_); |
+ parent_->web_layer_->replaceChild(web_layer_, new_layer); |
+ } |
+ web_layer_= new_layer; |
+ for (size_t i = 0; i < children_.size(); ++i) { |
+ DCHECK(children_[i]->web_layer_); |
+ web_layer_->addChild(children_[i]->web_layer_); |
+ } |
+ web_layer_->setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); |
+ web_layer_->setOpaque(fills_bounds_opaquely_); |
+ web_layer_->setOpacity(visible_ ? opacity_ : 0.f); |
+ web_layer_->setDebugBorderWidth(show_debug_borders_ ? 2 : 0); |
+ web_layer_->setForceRenderSurface(force_render_surface_); |
+ RecomputeTransform(); |
+ RecomputeDebugBorderColor(); |
+ } |
+ delegated_renderer_layer_->setFrameData(frame); |
+ RecomputeDrawsContentAndUVRect(); |
+} |
+ |
+void Layer::GetRecycledResources(cc::TransferableResourceList* list) { |
+ if (delegated_renderer_layer_.get()) |
+ delegated_renderer_layer_->getRecycledResources(list); |
+} |
+ |
void Layer::SetColor(SkColor color) { |
DCHECK_EQ(type_, LAYER_SOLID_COLOR); |
// WebColor is equivalent to SkColor, per WebColor.h. |