-void Layer::SetExternalTexture(Texture* texture) {
- DCHECK(texture);
-
- // Hold a ref to the old |Texture| until we have updated all
- // compositor references to the texture id that it holds.
- scoped_refptr<ui::Texture> old_texture = texture_;
-
- DCHECK_EQ(type_, LAYER_TEXTURED);
- DCHECK(!solid_color_layer_.get());
- texture_ = texture;
- if (!texture_layer_.get()) {
- scoped_refptr<cc::TextureLayer> new_layer = cc::TextureLayer::Create(this);
- new_layer->SetFlipped(texture_->flipped());
- SwitchToLayer(new_layer);
- texture_layer_ = new_layer;
- }
- RecomputeDrawsContentAndUVRect();
-}
-