+2012-04-13 Dana Jansens <danakj@chromium.org>
+
+ [chromium] Cleanup texture memory eviction when LayerTreeHost becomes invisible
+ https://bugs.webkit.org/show_bug.cgi?id=83899
+
+ Reviewed by Adrienne Walker.
+
+ When a LTH becomes invisible, the texture eviction is spread out across
+ two different functions and is not entirely clear. We move all the logic
+ together into a single place in didBecomeInvisibleOnImplThread() and
+ make the consequences of the current code more clear.
+
+ Covered by existing tests.
+
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::deleteContentsTexturesOnImplThread):
+ (WebCore::CCLayerTreeHost::setVisible):
+ (WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread):
+
2012-04-13 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r114036.
void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator)
{
ASSERT(CCProxy::isImplThread());
- if (m_contentsTextureManager)
+ if (m_layerRendererInitialized)
m_contentsTextureManager->evictAndDeleteAllTextures(allocator);
}
m_visible = visible;
- if (!visible && m_layerRendererInitialized) {
- // Drop all unprotected textures.
- m_contentsTextureManager->reduceMemoryToLimit(0);
- m_contentsTextureManager->unprotectAllTextures();
- }
-
// Tells the proxy that visibility state has changed. This will in turn call
// CCLayerTreeHost::didBecomeInvisibleOnImplThread on the appropriate thread, for
// the case where !visible.
if (!m_layerRendererInitialized)
return;
- if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer)
- contentsTextureManager()->evictAndDeleteAllTextures(hostImpl->contentsTextureAllocator());
- else {
- contentsTextureManager()->reduceMemoryToLimit(m_contentsTextureManager->preferredMemoryLimitBytes());
- contentsTextureManager()->deleteEvictedTextures(hostImpl->contentsTextureAllocator());
+ if (m_proxy->layerRendererCapabilities().contextHasCachedFrontBuffer) {
+ // Unprotect and delete all textures.
+ m_contentsTextureManager->unprotectAllTextures();
+ m_contentsTextureManager->reduceMemoryToLimit(0);
+ } else {
+ // Delete all unprotected textures, and only save textures that fit in the preferred memory limit.
+ m_contentsTextureManager->reduceMemoryToLimit(0);
+ m_contentsTextureManager->unprotectAllTextures();
+ m_contentsTextureManager->reduceMemoryToLimit(m_contentsTextureManager->preferredMemoryLimitBytes());
}
+ m_contentsTextureManager->deleteEvictedTextures(hostImpl->contentsTextureAllocator());
hostImpl->setRootLayer(TreeSynchronizer::synchronizeTrees(rootLayer(), hostImpl->releaseRootLayer()));