Changeset 107014 in webkit


Ignore:
Timestamp:
Feb 7, 2012 5:03:07 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by David Reveman <reveman@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):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r107013 r107014  
     12012-02-07  David Reveman  <reveman@chromium.org>
     2
     3        [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting.
     4        https://bugs.webkit.org/show_bug.cgi?id=78020
     5
     6        Reviewed by James Robinson.
     7
     8        Revert r101854.
     9
     10        This patch is tested by the following unit test:
     11        - TextureManagerTest.requestTextureExceedingPreferredLimit
     12
     13        * platform/graphics/chromium/ManagedTexture.cpp:
     14        (WebCore::ManagedTexture::reserve):
     15        * platform/graphics/chromium/TextureManager.cpp:
     16        (WebCore::TextureManager::requestTexture):
     17        * platform/graphics/chromium/TextureManager.h:
     18        (TextureManager):
     19
    1202012-02-07  Anders Carlsson  <andersca@apple.com>
    221
  • trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp

    r106891 r107014  
    9393    else {
    9494        m_textureId = 0;
    95         reserved = m_textureManager->requestTexture(m_token, size, format, m_textureId);
     95        reserved = m_textureManager->requestTexture(m_token, size, format);
    9696        if (reserved) {
    9797            m_size = size;
  • trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp

    r106840 r107014  
    204204}
    205205
    206 unsigned TextureManager::replaceTexture(TextureToken newToken, TextureInfo newInfo)
    207 {
    208     for (ListHashSet<TextureToken>::iterator lruIt = m_textureLRUSet.begin(); lruIt != m_textureLRUSet.end(); ++lruIt) {
    209         TextureToken token = *lruIt;
    210         TextureInfo info = m_textures.get(token);
    211         if (info.isProtected)
    212             continue;
    213         if (!info.textureId)
    214             continue;
    215         if (newInfo.size != info.size || newInfo.format != info.format)
    216             continue;
    217         newInfo.textureId = info.textureId;
    218 #ifndef NDEBUG
    219         newInfo.allocator = info.allocator;
    220 #endif
    221         m_textures.remove(token);
    222         m_textureLRUSet.remove(token);
    223         m_textures.set(newToken, newInfo);
    224         m_textureLRUSet.add(newToken);
    225         return info.textureId;
    226     }
    227     return 0;
    228 }
    229 
    230206void TextureManager::addTexture(TextureToken token, TextureInfo info)
    231207{
     
    292268}
    293269
    294 bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format, unsigned& textureId)
    295 {
    296     textureId = 0;
    297 
     270bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format)
     271{
    298272    if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize)
    299273        return false;
     
    321295    info.allocator = 0;
    322296#endif
    323     // Avoid churning by reusing the texture if it is about to be reclaimed and
    324     // it has the same size and format as the requesting texture.
    325     if (m_memoryUseBytes + memoryRequiredBytes > m_preferredMemoryLimitBytes) {
    326         textureId = replaceTexture(token, info);
    327         if (textureId)
    328             return true;
    329     }
    330297    addTexture(token, info);
    331298    return true;
  • trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h

    r106840 r107014  
    8080    bool hasTexture(TextureToken);
    8181
    82     bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat, unsigned& textureId);
     82    bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat);
    8383
    8484    void protectTexture(TextureToken);
     
    110110    void addTexture(TextureToken, TextureInfo);
    111111    void removeTexture(TextureToken, TextureInfo);
    112     unsigned replaceTexture(TextureToken, TextureInfo);
    113112
    114113    HashSet<ManagedTexture*> m_registeredTextures;
  • trunk/Source/WebKit/chromium/ChangeLog

    r106994 r107014  
     12012-02-07  David Reveman  <reveman@chromium.org>
     2
     3        [Chromium] REGRESSION(r101854): Causing large amounts of unnecessary repainting.
     4        https://bugs.webkit.org/show_bug.cgi?id=78020
     5
     6        Reviewed by James Robinson.
     7
     8        Update TextureManagerTest.requestTextureExceedingPreferredLimit test.
     9
     10        * tests/TextureManagerTest.cpp:
     11        (WTF::TextureManagerTest::requestTexture):
     12        (WTF::TEST_F):
     13
    1142012-02-07  Dana Jansens  <danakj@chromium.org>
    215
  • trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp

    r106891 r107014  
    6666    bool requestTexture(TextureManager* manager, TextureToken token)
    6767    {
    68         unsigned textureId;
    69         bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId);
     68        bool result = manager->requestTexture(token, m_textureSize, m_textureFormat);
    7069        if (result)
    7170            manager->allocateTexture(&m_fakeTextureAllocator, token);
     
    118117        EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i]));
    119118        EXPECT_TRUE(textureManager->hasTexture(tokens[i]));
    120         textureManager->unprotectTexture(tokens[i]);
    121     }
     119    }
     120
     121    textureManager->unprotectTexture(tokens[4]);
     122    textureManager->unprotectTexture(tokens[5]);
     123
     124    // These textures should be valid before the reduceMemoryToLimit call.
     125    EXPECT_TRUE(textureManager->hasTexture(tokens[0]));
     126    EXPECT_TRUE(textureManager->hasTexture(tokens[2]));
     127
     128    textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures));
    122129
    123130    EXPECT_FALSE(textureManager->hasTexture(tokens[0]));
Note: See TracChangeset for help on using the changeset viewer.