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

Unified Diff: ui/compositor/layer.cc

Issue 10689108: Aura: Have ui::Layer implement WebKit::WebExternalTextureLayerClient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address reviewer comments, remove dead code, plumb through context. Created 8 years, 5 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
« ui/compositor/compositor.cc ('K') | « ui/compositor/layer.h ('k') | no next file » | 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 f45fd8471ce856aeb92ca0bb815003694cf64945..33d32d0f6f37aebd813886de8b7f03c057cc17bd 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -311,10 +311,16 @@ void Layer::SetExternalTexture(Texture* texture) {
WebKit::WebLayer new_layer;
if (layer_updated_externally_) {
WebKit::WebExternalTextureLayer texture_layer =
- WebKit::WebExternalTextureLayer::create();
+ WebKit::WebExternalTextureLayer::create(this);
texture_layer.setFlipped(texture_->flipped());
new_layer = texture_layer;
} else {
+ if (!web_layer_.isNull()) {
piman 2012/07/12 00:18:09 I don't think web_layer_.isNull() is ever true (we
jonathan.backer 2012/07/12 13:53:22 Thanks. Done.
+ // Tell the compositor to clear references to the old texture.
+ WebKit::WebExternalTextureLayer texture_layer =
+ web_layer_.to<WebKit::WebExternalTextureLayer>();
+ texture_layer.willModifyTexture();
+ }
new_layer = WebKit::WebContentLayer::create(this);
}
if (parent_) {
@@ -435,6 +441,16 @@ void Layer::paintContents(WebKit::WebCanvas* web_canvas,
delegate_->OnPaintLayer(&canvas);
}
+unsigned Layer::prepareTexture(WebKit::WebTextureUpdater& /* updater */) {
+ DCHECK(layer_updated_externally_);
+ return texture_->texture_id();
+}
+
+WebKit::WebGraphicsContext3D* Layer::context() {
+ DCHECK(layer_updated_externally_);
+ return texture_->hostContext3D();
+}
+
void Layer::SetForceRenderSurface(bool force) {
if (force_render_surface_ == force)
return;
@@ -634,10 +650,8 @@ void Layer::RecomputeDrawsContentAndUVRect() {
web_layer_.setBounds(ConvertSizeToPixel(this, bounds_.size()));
} else {
DCHECK(texture_);
- unsigned int texture_id = texture_->texture_id();
WebKit::WebExternalTextureLayer texture_layer =
web_layer_.to<WebKit::WebExternalTextureLayer>();
- texture_layer.setTextureId(should_draw ? texture_id : 0);
gfx::Size texture_size;
if (scale_content_)
« ui/compositor/compositor.cc ('K') | « ui/compositor/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698