[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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@104370 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8fa8b1e8
2012-01-06 Viatcheslav Ostapenko <ostapenko.viatcheslav@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 <ap@apple.com>
[Mac] Thread verifier assertions when printing
......@@ -401,6 +401,9 @@ WebGraphicsLayer* toWebGraphicsLayer(GraphicsLayer* layer)
void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
{
if (!m_layerTreeTileClient)
m_layerTreeTileClient = layerTreeTileClient();
updateContentBuffers();
if (!m_modified)
......@@ -431,12 +434,11 @@ void WebGraphicsLayer::syncCompositingStateForThisLayerOnly()
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 @@ void WebGraphicsLayer::recreateBackingStoreIfNeeded()
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)
......
......@@ -124,7 +124,7 @@ public:
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;
......
......@@ -52,6 +52,8 @@ PassRefPtr<LayerTreeHostQt> LayerTreeHostQt::create(WebPage* webPage)
LayerTreeHostQt::~LayerTreeHostQt()
{
if (m_rootLayer)
toWebGraphicsLayer(m_rootLayer.get())->setLayerTreeTileClient(0);
}
LayerTreeHostQt::LayerTreeHostQt(WebPage* webPage)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment