Title: [94964] trunk/Source/WebCore
- Revision
- 94964
- Author
- jam...@google.com
- Date
- 2011-09-12 10:52:51 -0700 (Mon, 12 Sep 2011)
Log Message
[chromium] REGRESSION(94353): Compositor textures and resources leaked when tab closed that is not last tab in the process
https://bugs.webkit.org/show_bug.cgi?id=67816
Reviewed by Kenneth Russell.
We lack infrastructure to construct an automated test for this today. To test manually, open up a composited
page (like the poster circle), duplicate the tab many times, close all the duplicates, and verify that the
memory use returns to the single tab level.
* platform/graphics/chromium/LayerChromium.h:
* platform/graphics/chromium/TiledLayerChromium.cpp:
(WebCore::TiledLayerChromium::setLayerTreeHost):
* platform/graphics/chromium/VideoLayerChromium.cpp:
(WebCore::VideoLayerChromium::setLayerTreeHost):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::clearRenderSurfacesRecursive):
(WebCore::CCLayerTreeHost::setRootLayer):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (94963 => 94964)
--- trunk/Source/WebCore/ChangeLog 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/ChangeLog 2011-09-12 17:52:51 UTC (rev 94964)
@@ -1,3 +1,24 @@
+2011-09-12 James Robinson <jam...@chromium.org>
+
+ [chromium] REGRESSION(94353): Compositor textures and resources leaked when tab closed that is not last tab in the process
+ https://bugs.webkit.org/show_bug.cgi?id=67816
+
+ Reviewed by Kenneth Russell.
+
+ We lack infrastructure to construct an automated test for this today. To test manually, open up a composited
+ page (like the poster circle), duplicate the tab many times, close all the duplicates, and verify that the
+ memory use returns to the single tab level.
+
+ * platform/graphics/chromium/LayerChromium.h:
+ * platform/graphics/chromium/TiledLayerChromium.cpp:
+ (WebCore::TiledLayerChromium::setLayerTreeHost):
+ * platform/graphics/chromium/VideoLayerChromium.cpp:
+ (WebCore::VideoLayerChromium::setLayerTreeHost):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::clearRenderSurfacesRecursive):
+ (WebCore::CCLayerTreeHost::setRootLayer):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+
2011-09-12 Kentaro Hara <hara...@google.com>
Implement a HashChangeEvent constructor for JSC
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h (94963 => 94964)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.h 2011-09-12 17:52:51 UTC (rev 94964)
@@ -207,7 +207,7 @@
bool descendantDrawsContent();
CCLayerTreeHost* layerTreeHost() const { return m_layerTreeHost.get(); }
- virtual void cleanupResourcesRecursive();
+ void cleanupResourcesRecursive();
protected:
GraphicsLayerChromium* m_owner;
Modified: trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp (94963 => 94964)
--- trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/platform/graphics/chromium/TiledLayerChromium.cpp 2011-09-12 17:52:51 UTC (rev 94964)
@@ -138,7 +138,7 @@
{
LayerChromium::setLayerTreeHost(host);
- if (m_tiler)
+ if (m_tiler || !host)
return;
createTextureUpdater(host);
Modified: trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp (94963 => 94964)
--- trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp 2011-09-12 17:52:51 UTC (rev 94964)
@@ -148,7 +148,7 @@
void VideoLayerChromium::setLayerTreeHost(CCLayerTreeHost* host)
{
- if (layerTreeHost() != host) {
+ if (host && layerTreeHost() != host) {
for (size_t i = 0; i < 3; ++i) {
m_textures[i].m_visibleSize = IntSize();
m_textures[i].m_texture = ManagedTexture::create(host->contentsTextureManager());
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (94963 => 94964)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-09-12 17:52:51 UTC (rev 94964)
@@ -214,12 +214,32 @@
#endif
}
+void CCLayerTreeHost::clearRenderSurfacesRecursive(LayerChromium* layer)
+{
+ for (size_t i = 0; i < layer->children().size(); ++i)
+ clearRenderSurfacesRecursive(layer->children()[i].get());
+
+ if (layer->replicaLayer())
+ clearRenderSurfacesRecursive(layer->replicaLayer());
+
+ if (layer->maskLayer())
+ clearRenderSurfacesRecursive(layer->maskLayer());
+
+ layer->clearRenderSurface();
+}
+
+
void CCLayerTreeHost::setRootLayer(GraphicsLayer* layer)
{
m_nonCompositedContentHost->graphicsLayer()->removeAllChildren();
m_nonCompositedContentHost->invalidateEntireLayer();
if (layer)
m_nonCompositedContentHost->graphicsLayer()->addChild(layer);
+ else {
+ clearRenderSurfacesRecursive(rootLayer()->platformLayer());
+ m_nonCompositedContentHost->graphicsLayer()->platformLayer()->setLayerTreeHost(0);
+ m_rootLayer->platformLayer()->setLayerTreeHost(0);
+ }
}
void CCLayerTreeHost::setViewport(const IntSize& viewportSize, const IntSize& contentsSize, const IntPoint& scrollPosition)
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (94963 => 94964)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-09-12 17:45:27 UTC (rev 94963)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h 2011-09-12 17:52:51 UTC (rev 94964)
@@ -168,6 +168,8 @@
void updateCompositorResources(const LayerList&, GraphicsContext3D*);
void updateCompositorResources(LayerChromium*, GraphicsContext3D*);
+ void clearRenderSurfacesRecursive(LayerChromium*);
+
bool initialize();
PassRefPtr<LayerRendererChromium> createLayerRenderer();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes