Title: [104370] trunk/Source/WebKit2
Revision
104370
Author
ostapenko.viatches...@nokia.com
Date
2012-01-06 18:50:25 -0800 (Fri, 06 Jan 2012)

Log Message

[Qt] [WK2] Minibrowser leaks memory ~6-7Mb per reload
https://bugs.webkit.org/show_bug.cgi?id=75746

Reset WebGraphicsLayer::m_layerTreeTileClient of all dependent
layers from ~LayerTreeHostQt(). This replaces r103760 which
causes leaks of GraphicsLayerTextureMapper objects on UI side.

Reviewed by Noam Rosenthal.

* WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
(WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
(WebCore::WebGraphicsLayer::setLayerTreeTileClient):
* WebProcess/WebCoreSupport/WebGraphicsLayer.h:
* WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
(WebKit::LayerTreeHostQt::~LayerTreeHostQt):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (104369 => 104370)


--- trunk/Source/WebKit2/ChangeLog	2012-01-07 02:43:54 UTC (rev 104369)
+++ trunk/Source/WebKit2/ChangeLog	2012-01-07 02:50:25 UTC (rev 104370)
@@ -1,3 +1,21 @@
+2012-01-06  Viatcheslav Ostapenko  <ostapenko.viatches...@nokia.com>
+
+        [Qt] [WK2] Minibrowser leaks memory ~6-7Mb per reload
+        https://bugs.webkit.org/show_bug.cgi?id=75746
+
+        Reset WebGraphicsLayer::m_layerTreeTileClient of all dependent 
+        layers from ~LayerTreeHostQt(). This replaces r103760 which
+        causes leaks of GraphicsLayerTextureMapper objects on UI side. 
+
+        Reviewed by Noam Rosenthal.
+
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.cpp:
+        (WebCore::WebGraphicsLayer::syncCompositingStateForThisLayerOnly):
+        (WebCore::WebGraphicsLayer::setLayerTreeTileClient):
+        * WebProcess/WebCoreSupport/WebGraphicsLayer.h:
+        * WebProcess/WebPage/qt/LayerTreeHostQt.cpp:
+        (WebKit::LayerTreeHostQt::~LayerTreeHostQt):
+
 2012-01-06  Alexey Proskuryakov  <a...@apple.com>
 
         [Mac] Thread verifier assertions when printing

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp (104369 => 104370)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-07 02:43:54 UTC (rev 104369)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.cpp	2012-01-07 02:50:25 UTC (rev 104370)
@@ -401,6 +401,9 @@
 
 void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
 {
+    if (!m_layerTreeTileClient)
+        m_layerTreeTileClient = layerTreeTileClient();
+
     updateContentBuffers();
 
     if (!m_modified)
@@ -431,12 +434,11 @@
     for (size_t i = 0; i < children().size(); ++i)
         m_layerInfo.children.append(toWebLayerID(children()[i]));
 
-    WebLayerTreeTileClient* tileClient = layerTreeTileClient();
-    ASSERT(tileClient);
+    ASSERT(m_layerTreeTileClient);
     if (m_layerInfo.imageIsUpdated && m_image && !m_layerInfo.imageBackingStoreID)
-        m_layerInfo.imageBackingStoreID = tileClient->adoptImageBackingStore(m_image.get());
+        m_layerInfo.imageBackingStoreID = m_layerTreeTileClient->adoptImageBackingStore(m_image.get());
 
-    tileClient->didSyncCompositingStateForLayer(m_layerInfo);
+    m_layerTreeTileClient->didSyncCompositingStateForLayer(m_layerInfo);
     m_modified = false;
     m_layerInfo.imageIsUpdated = false;
     if (m_hasPendingAnimations)
@@ -612,6 +614,22 @@
     if (m_image)
         setContentsNeedsDisplay();
 }
+
+void WebGraphicsLayer::setLayerTreeTileClient(WebKit::WebLayerTreeTileClient* client)
+{
+    if (m_layerTreeTileClient == client)
+        return;
+
+    for (size_t i = 0; i < children().size(); ++i) {
+        WebGraphicsLayer* layer = toWebGraphicsLayer(this->children()[i]);
+        layer->setLayerTreeTileClient(client);
+    }
+
+    // Have to force detach from remote layer here if layer tile client changes.
+    if (m_layerTreeTileClient)
+        m_layerTreeTileClient->didDeleteLayer(id());
+    m_layerTreeTileClient = client;
+}
 #endif
 
 static PassOwnPtr<GraphicsLayer> createWebGraphicsLayer(GraphicsLayerClient* client)

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h (104369 => 104370)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-07 02:43:54 UTC (rev 104369)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebGraphicsLayer.h	2012-01-07 02:50:25 UTC (rev 104370)
@@ -124,7 +124,7 @@
     virtual void updateTile(int tileID, const WebKit::UpdateInfo&);
     virtual void removeTile(int tileID);
 
-    void setLayerTreeTileClient(WebKit::WebLayerTreeTileClient* client) { m_layerTreeTileClient = client; }
+    void setLayerTreeTileClient(WebKit::WebLayerTreeTileClient*);
     WebKit::WebLayerTreeTileClient* layerTreeTileClient() const;
 
     bool isReadyForTileBufferSwap() const;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp (104369 => 104370)


--- trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp	2012-01-07 02:43:54 UTC (rev 104369)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/LayerTreeHostQt.cpp	2012-01-07 02:50:25 UTC (rev 104370)
@@ -52,6 +52,8 @@
 
 LayerTreeHostQt::~LayerTreeHostQt()
 {
+    if (m_rootLayer)
+        toWebGraphicsLayer(m_rootLayer.get())->setLayerTreeTileClient(0);
 }
 
 LayerTreeHostQt::LayerTreeHostQt(WebPage* webPage)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to