Changeset 107014 in webkit
- Timestamp:
- Feb 7, 2012 5:03:07 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r107013 r107014 1 2012-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 1 20 2012-02-07 Anders Carlsson <andersca@apple.com> 2 21 -
trunk/Source/WebCore/platform/graphics/chromium/ManagedTexture.cpp
r106891 r107014 93 93 else { 94 94 m_textureId = 0; 95 reserved = m_textureManager->requestTexture(m_token, size, format , m_textureId);95 reserved = m_textureManager->requestTexture(m_token, size, format); 96 96 if (reserved) { 97 97 m_size = size; -
trunk/Source/WebCore/platform/graphics/chromium/TextureManager.cpp
r106840 r107014 204 204 } 205 205 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 NDEBUG219 newInfo.allocator = info.allocator;220 #endif221 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 230 206 void TextureManager::addTexture(TextureToken token, TextureInfo info) 231 207 { … … 292 268 } 293 269 294 bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format, unsigned& textureId) 295 { 296 textureId = 0; 297 270 bool TextureManager::requestTexture(TextureToken token, IntSize size, unsigned format) 271 { 298 272 if (size.width() > m_maxTextureSize || size.height() > m_maxTextureSize) 299 273 return false; … … 321 295 info.allocator = 0; 322 296 #endif 323 // Avoid churning by reusing the texture if it is about to be reclaimed and324 // 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 }330 297 addTexture(token, info); 331 298 return true; -
trunk/Source/WebCore/platform/graphics/chromium/TextureManager.h
r106840 r107014 80 80 bool hasTexture(TextureToken); 81 81 82 bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat , unsigned& textureId);82 bool requestTexture(TextureToken, IntSize, GC3Denum textureFormat); 83 83 84 84 void protectTexture(TextureToken); … … 110 110 void addTexture(TextureToken, TextureInfo); 111 111 void removeTexture(TextureToken, TextureInfo); 112 unsigned replaceTexture(TextureToken, TextureInfo);113 112 114 113 HashSet<ManagedTexture*> m_registeredTextures; -
trunk/Source/WebKit/chromium/ChangeLog
r106994 r107014 1 2012-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 1 14 2012-02-07 Dana Jansens <danakj@chromium.org> 2 15 -
trunk/Source/WebKit/chromium/tests/TextureManagerTest.cpp
r106891 r107014 66 66 bool requestTexture(TextureManager* manager, TextureToken token) 67 67 { 68 unsigned textureId; 69 bool result = manager->requestTexture(token, m_textureSize, m_textureFormat, textureId); 68 bool result = manager->requestTexture(token, m_textureSize, m_textureFormat); 70 69 if (result) 71 70 manager->allocateTexture(&m_fakeTextureAllocator, token); … … 118 117 EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); 119 118 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)); 122 129 123 130 EXPECT_FALSE(textureManager->hasTexture(tokens[0]));
Note: See TracChangeset
for help on using the changeset viewer.