Title: [107014] trunk/Source
Revision
107014
Author
commit-qu...@webkit.org
Date
2012-02-07 17:03:07 -0800 (Tue, 07 Feb 2012)

Log Message

[Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting.
https://bugs.webkit.org/show_bug.cgi?id=78020

Patch by David Reveman <reve...@chromium.org> on 2012-02-07
Reviewed by James Robinson.

Source/WebCore:

Revert r101854.

This patch is tested by the following unit test:
- TextureManagerTest.requestTextureExceedingPreferredLimit

* platform/graphics/chromium/ManagedTexture.cpp:
(WebCore::ManagedTexture::reserve):
* platform/graphics/chromium/TextureManager.cpp:
(WebCore::TextureManager::requestTexture):
* platform/graphics/chromium/TextureManager.h:
(TextureManager):

Source/WebKit/chromium:

Update TextureManagerTest.requestTextureExceedingPreferredLimit test.

* tests/TextureManagerTest.cpp:
(WTF::TextureManagerTest::requestTexture):
(WTF::TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (107013 => 107014)


--- trunk/Source/WebCore/ChangeLog	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebCore/ChangeLog	2012-02-08 01:03:07 UTC (rev 107014)
@@ -1,3 +1,22 @@
+2012-02-07  David Reveman  <reve...@chromium.org>
+
+        [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting.
+        https://bugs.webkit.org/show_bug.cgi?id=78020
+
+        Reviewed by James Robinson.
+
+        Revert r101854.
+
+        This patch is tested by the following unit test:
+        - TextureManagerTest.requestTextureExceedingPreferredLimit
+
+        * platform/graphics/chromium/ManagedTexture.cpp:
+        (WebCore::ManagedTexture::reserve):
+        * platform/graphics/chromium/TextureManager.cpp:
+        (WebCore::TextureManager::requestTexture):
+        * platform/graphics/chromium/TextureManager.h:
+        (TextureManager):
+
 2012-02-07  Anders Carlsson  <ander...@apple.com>
 
         Use the non-fast-scrollable region to detect when we can't do fast scrolling

Modified: trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp (107013 => 107014)


--- trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp	2012-02-08 01:03:07 UTC (rev 107014)
@@ -92,7 +92,7 @@
         m_textureManager->protectTexture(m_token);
     else {
         m_textureId = 0;
-        reserved = m_textureManager->requestTexture(m_token, size, format, m_textureId);
+        reserved = m_textureManager->requestTexture(m_token, size, format);
         if (reserved) {
             m_size = size;
             m_format = format;

Modified: trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp (107013 => 107014)


--- trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp	2012-02-08 01:03:07 UTC (rev 107014)
@@ -203,30 +203,6 @@
     }
 }
 
-unsigned TextureManager::replaceTexture(TextureToken newToken, TextureInfo newInfo)
-{
-    for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) {
-        TextureToken token = *lruIt;
-        TextureInfo info = m_textures.get(token);
-        if (info.isProtected)
-            continue;
-        if (!info.textureId)
-            continue;
-        if (newInfo.size != info.size || newInfo.format != info.format)
-            continue;
-        newInfo.textureId = info.textureId;
-#ifndef NDEBUG
-        newInfo.allocator = info.allocator;
-#endif
-        m_textures.remove(token);
-        m_textureLRUSet.remove(token);
-        m_textures.set(newToken, newInfo);
-        m_textureLRUSet.add(newToken);
-        return info.textureId;
-    }
-    return 0;
-}
-
 void TextureManager::addTexture(TextureToken token, TextureInfo info)
 {
     ASSERT(!m_textureLRUSet.contains(token));
@@ -291,10 +267,8 @@
     return textureId;
 }
 
-bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format, unsigned& textureId)
+bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format)
 {
-    textureId = 0;
-
     if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize)
         return false;
 
@@ -320,13 +294,6 @@
 #ifndef NDEBUG
     info.allocator = 0;
 #endif
-    // Avoid churning by reusing the texture if it is about to be reclaimed and
-    // it has the same size and format as the requesting texture.
-    if (m_memoryUseBytes + memoryRequiredBytes > m_preferredMemoryLimitBytes) {
-        textureId = replaceTexture(token, info);
-        if (textureId)
-            return true;
-    }
     addTexture(token, info);
     return true;
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h (107013 => 107014)


--- trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h	2012-02-08 01:03:07 UTC (rev 107014)
@@ -79,7 +79,7 @@
     void releaseToken(TextureToken);
     bool hasTexture(TextureToken);
 
-    bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat, unsigned& textureId);
+    bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat);
 
     void protectTexture(TextureToken);
     void unprotectTexture(TextureToken);
@@ -109,7 +109,6 @@
 
     void addTexture(TextureToken, TextureInfo);
     void removeTexture(TextureToken, TextureInfo);
-    unsigned replaceTexture(TextureToken, TextureInfo);
 
     HashSet<ManagedTexture*> m_registeredTextures;
 

Modified: trunk/Source/WebKit/chromium/ChangeLog (107013 => 107014)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-02-08 01:03:07 UTC (rev 107014)
@@ -1,3 +1,16 @@
+2012-02-07  David Reveman  <reve...@chromium.org>
+
+        [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting.
+        https://bugs.webkit.org/show_bug.cgi?id=78020
+
+        Reviewed by James Robinson.
+
+        Update TextureManagerTest.requestTextureExceedingPreferredLimit test.
+
+        * tests/TextureManagerTest.cpp:
+        (WTF::TextureManagerTest::requestTexture):
+        (WTF::TEST_F):
+
 2012-02-07  Dana Jansens  <dan...@chromium.org>
 
         [chromium] Unit test for bug #77996

Modified: trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp (107013 => 107014)


--- trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp	2012-02-08 01:00:06 UTC (rev 107013)
+++ trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp	2012-02-08 01:03:07 UTC (rev 107014)
@@ -65,8 +65,7 @@
 
     bool requestTexture(TextureManager* manager, TextureToken token)
     {
-        unsigned textureId;
-        bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId);
+        bool result = manager->requestTexture(token, m_textureSize, m_textureFormat);
         if (result)
             manager->allocateTexture(&m_fakeTextureAllocator, token);
         return result;
@@ -117,9 +116,17 @@
         tokens[i] = textureManager->getToken();
         EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i]));
         EXPECT_TRUE(textureManager->hasTexture(tokens[i]));
-        textureManager->unprotectTexture(tokens[i]);
     }
 
+    textureManager->unprotectTexture(tokens[4]);
+    textureManager->unprotectTexture(tokens[5]);
+
+    // These textures should be valid before the reduceMemoryToLimit call.
+    EXPECT_TRUE(textureManager->hasTexture(tokens[0]));
+    EXPECT_TRUE(textureManager->hasTexture(tokens[2]));
+
+    textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures));
+
     EXPECT_FALSE(textureManager->hasTexture(tokens[0]));
     EXPECT_TRUE(textureManager->hasTexture(tokens[1]));
     EXPECT_TRUE(textureManager->isProtected(tokens[1]));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to