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

Side by Side Diff: ui/gfx/compositor/compositor_cc.cc

Issue 8772047: Fixes leak/crash in CompositorCC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/compositor/compositor_cc.h" 5 #include "ui/gfx/compositor/compositor_cc.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "third_party/skia/include/images/SkImageEncoder.h" 8 #include "third_party/skia/include/images/SkImageEncoder.h"
9 #include "third_party/skia/include/core/SkBitmap.h" 9 #include "third_party/skia/include/core/SkBitmap.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 command_line->HasSwitch(switches::kUIShowLayerTree); 138 command_line->HasSwitch(switches::kUIShowLayerTree);
139 #ifndef WEBCOMPOSITOR_HAS_INITIALIZE 139 #ifndef WEBCOMPOSITOR_HAS_INITIALIZE
140 settings.enableCompositorThread = !!g_compositor_thread; 140 settings.enableCompositorThread = !!g_compositor_thread;
141 #endif 141 #endif
142 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings); 142 host_ = WebKit::WebLayerTreeView::create(this, root_web_layer_, settings);
143 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f)); 143 root_web_layer_.setAnchorPoint(WebKit::WebFloatPoint(0.f, 0.f));
144 OnWidgetSizeChanged(); 144 OnWidgetSizeChanged();
145 } 145 }
146 146
147 CompositorCC::~CompositorCC() { 147 CompositorCC::~CompositorCC() {
148 // There's a cycle between |root_web_layer_| and |host_|, which results in
149 // leaking and/or crashing. Explicitly set the root layer to NULL so the cycle
150 // is broken.
151 host_.setRootLayer(NULL);
148 } 152 }
149 153
150 void CompositorCC::Initialize(bool use_thread) { 154 void CompositorCC::Initialize(bool use_thread) {
151 if (use_thread) 155 if (use_thread)
152 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor"); 156 g_compositor_thread = new webkit_glue::WebThreadImpl("Browser Compositor");
153 #ifdef WEBCOMPOSITOR_HAS_INITIALIZE 157 #ifdef WEBCOMPOSITOR_HAS_INITIALIZE
154 WebKit::WebCompositor::initialize(g_compositor_thread); 158 WebKit::WebCompositor::initialize(g_compositor_thread);
155 #else 159 #else
156 if (use_thread) 160 if (use_thread)
157 WebKit::WebCompositor::setThread(g_compositor_thread); 161 WebKit::WebCompositor::setThread(g_compositor_thread);
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 ScheduleDraw(); 279 ScheduleDraw();
276 } 280 }
277 281
278 Compositor* Compositor::Create(CompositorDelegate* owner, 282 Compositor* Compositor::Create(CompositorDelegate* owner,
279 gfx::AcceleratedWidget widget, 283 gfx::AcceleratedWidget widget,
280 const gfx::Size& size) { 284 const gfx::Size& size) {
281 return new CompositorCC(owner, widget, size); 285 return new CompositorCC(owner, widget, size);
282 } 286 }
283 287
284 } // namespace ui 288 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698