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

Unified Diff: ui/compositor/layer.cc

Issue 11458003: Remove scoped_refptr::release which is confusing and causes leaks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac Created 8 years 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
Index: ui/compositor/layer.cc
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index 715b8e1a09538b4349723a7656519531fe4b258a..caf1af0023acc37bf7b3f0fa6887e07ca2691550 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);

Powered by Google App Engine
This is Rietveld 408576698