Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(273)

Unified Diff: ui/compositor/layer.cc

Issue 10915298: Add CCDelegatingRenderer, and corresponding IPCs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer.h ('k') | webkit/compositor_bindings/WebDelegatedRendererLayerImpl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « ui/compositor/layer.h ('k') | webkit/compositor_bindings/WebDelegatedRendererLayerImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698