summaryrefslogtreecommitdiffstats
path: root/ui/compositor
diff options
context:
space:
mode:
Diffstat (limited to 'ui/compositor')
-rw-r--r--ui/compositor/layer.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 715b8e1..caf1af0 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -409,17 +409,18 @@ void Layer::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
void Layer::SetExternalTexture(Texture* texture) {
DCHECK_EQ(type_, LAYER_TEXTURED);
+ DCHECK(!solid_color_layer_);
layer_updated_externally_ = !!texture;
texture_ = texture;
if (cc_layer_is_accelerated_ != layer_updated_externally_) {
// Switch to a different type of layer.
cc_layer_->removeAllChildren();
- scoped_refptr<cc::ContentLayer> old_content_layer(
- content_layer_.release());
- scoped_refptr<cc::SolidColorLayer> old_solid_layer(
- solid_color_layer_.release());
- scoped_refptr<cc::TextureLayer> old_texture_layer(
- texture_layer_.release());
+
+ scoped_refptr<cc::ContentLayer> old_content_layer;
+ old_content_layer.swap(content_layer_);
+ scoped_refptr<cc::TextureLayer> old_texture_layer;
+ old_texture_layer.swap(texture_layer_);
+
cc::Layer* new_layer = NULL;
if (layer_updated_externally_) {
texture_layer_ = cc::TextureLayer::create(this);