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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107014 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 858c9c88
2012-02-07 David Reveman <reveman@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 <andersca@apple.com>
Use the non-fast-scrollable region to detect when we can't do fast scrolling
......@@ -92,7 +92,7 @@ bool ManagedTexture::reserve(const IntSize& size, unsigned format)
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;
......
......@@ -203,30 +203,6 @@ void TextureManager::reduceMemoryToLimit(size_t limit)
}
}
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 @@ unsigned TextureManager::allocateTexture(TextureAllocator* allocator, TextureTok
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 @@ bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned f
#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;
}
......
......@@ -79,7 +79,7 @@ public:
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 @@ private:
void addTexture(TextureToken, TextureInfo);
void removeTexture(TextureToken, TextureInfo);
unsigned replaceTexture(TextureToken, TextureInfo);
HashSet<ManagedTexture*> m_registeredTextures;
......
2012-02-07 David Reveman <reveman@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 <danakj@chromium.org>
[chromium] Unit test for bug #77996
......@@ -65,8 +65,7 @@ public:
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 @@ TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit)
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]));
......
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