Title: [114202] trunk/Source/WebCore
Revision
114202
Author
dan...@chromium.org
Date
2012-04-13 20:32:40 -0700 (Fri, 13 Apr 2012)

Log Message

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (114201 => 114202)


--- trunk/Source/WebCore/ChangeLog	2012-04-14 03:07:21 UTC (rev 114201)
+++ trunk/Source/WebCore/ChangeLog	2012-04-14 03:32:40 UTC (rev 114202)
@@ -1,3 +1,22 @@
+2012-04-13  Dana Jansens  <dan...@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....@gmail.com>
 
         Unreviewed, rolling out r114036.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (114201 => 114202)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-14 03:07:21 UTC (rev 114201)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-04-14 03:32:40 UTC (rev 114202)
@@ -180,7 +180,7 @@
 void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator)
 {
     ASSERT(CCProxy::isImplThread());
-    if (m_contentsTextureManager)
+    if (m_layerRendererInitialized)
         m_contentsTextureManager->evictAndDeleteAllTextures(allocator);
 }
 
@@ -369,12 +369,6 @@
 
     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.
@@ -387,12 +381,17 @@
     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()));
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to