Coordinated Graphics: Make sure that we release images immediately when purging resources

https://bugs.webkit.org/show_bug.cgi?id=100661

Reviewed by Noam Rosenthal.

When we purge, we do both on the UI and web process at the same time,
both are expected to release references of the other process.
This creates problem when delaying the release of directly composited
images.

Release them immediately in that case.

Fixes the tst_QQuickWebView::removeFromCanvas API test.

* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::flushPendingLayerChanges):
(WebKit::LayerTreeCoordinator::purgeReleasedImages):
(WebKit):
(WebKit::LayerTreeCoordinator::purgeBackingStores):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
(LayerTreeCoordinator):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@132801 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f1fa3647
2012-10-29 Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Coordinated Graphics: Make sure that we release images immediately when purging resources
https://bugs.webkit.org/show_bug.cgi?id=100661
Reviewed by Noam Rosenthal.
When we purge, we do both on the UI and web process at the same time,
both are expected to release references of the other process.
This creates problem when delaying the release of directly composited
images.
Release them immediately in that case.
Fixes the tst_QQuickWebView::removeFromCanvas API test.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.cpp:
(WebKit::LayerTreeCoordinator::flushPendingLayerChanges):
(WebKit::LayerTreeCoordinator::purgeReleasedImages):
(WebKit):
(WebKit::LayerTreeCoordinator::purgeBackingStores):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeCoordinator.h:
(LayerTreeCoordinator):
2012-10-29 Christophe Dumez <christophe.dumez@intel.com>
[EFL][WK2] Avoid useless assignment in EwkViewImpl::setCustomTextEncodingName()
......
......@@ -267,9 +267,7 @@ bool LayerTreeCoordinator::flushPendingLayerChanges()
m_rootLayer->flushCompositingStateForThisLayerOnly();
for (size_t i = 0; i < m_releasedDirectlyCompositedImages.size(); ++i)
m_webPage->send(Messages::LayerTreeCoordinatorProxy::DestroyDirectlyCompositedImage(m_releasedDirectlyCompositedImages[i]));
m_releasedDirectlyCompositedImages.clear();
purgeReleasedImages();
if (m_shouldSyncRootLayer) {
m_webPage->send(Messages::LayerTreeCoordinatorProxy::SetRootCompositingLayer(toCoordinatedGraphicsLayer(m_rootLayer.get())->id()));
......@@ -449,6 +447,13 @@ void LayerTreeCoordinator::didPerformScheduledLayerFlush()
}
}
void LayerTreeCoordinator::purgeReleasedImages()
{
for (size_t i = 0; i < m_releasedDirectlyCompositedImages.size(); ++i)
m_webPage->send(Messages::LayerTreeCoordinatorProxy::DestroyDirectlyCompositedImage(m_releasedDirectlyCompositedImages[i]));
m_releasedDirectlyCompositedImages.clear();
}
void LayerTreeCoordinator::layerFlushTimerFired(Timer<LayerTreeCoordinator>*)
{
performScheduledLayerFlush();
......@@ -682,7 +687,10 @@ void LayerTreeCoordinator::purgeBackingStores()
for (HashSet<WebCore::CoordinatedGraphicsLayer*>::iterator it = m_registeredLayers.begin(); it != end; ++it)
(*it)->purgeBackingStores();
purgeReleasedImages();
ASSERT(!m_directlyCompositedImageRefCounts.size());
ASSERT(!m_releasedDirectlyCompositedImages.size());
m_updateAtlases.clear();
}
......
......@@ -125,6 +125,7 @@ private:
void syncDisplayState();
void lockAnimations();
void unlockAnimations();
void purgeReleasedImages();
void layerFlushTimerFired(WebCore::Timer<LayerTreeCoordinator>*);
......
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