Changeset 128253 in webkit
- Timestamp:
- Sep 11, 2012 6:35:47 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128251 r128253 1 2012-09-11 Christopher Cameron <ccameron@chromium.org> 2 3 [chromium] Make prioritized texture manager not touch backings array on the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=96114 5 6 Reviewed by James Robinson. 7 8 Take a snapshot of the textures' priorities from the main thread, 9 and save it in their backings for access by the impl thread. 10 Update functions that access the sorted backings array to use the 11 snapshotted values instead of the values that the main thread may 12 have computed for the next frame. 13 14 Make the main thread not touch the m_backings array. Split 15 prioritizeTextures into a updateBackingsPriorities function. 16 In places where the main thread would have touched m_backings, 17 set a flag specifying that m_backings needs to be re-sorted 18 before any function that requires it be sorted by priority be 19 executed. 20 21 Update the two functions that require sorted order (acquireBacking 22 and reduceMemory) to sort the backings array (if needed) before 23 traversing it. 24 25 Updated tests to set correct thread during asserts. Add a test to 26 verify that requestLate is correctly incorporated into the backing 27 sorting. 28 29 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: 30 (WebCore::CCPrioritizedTextureManager::CCPrioritizedTextureManager): 31 (WebCore::CCPrioritizedTextureManager::prioritizeTextures): 32 (WebCore): 33 (WebCore::CCPrioritizedTextureManager::prioritizeBackings): 34 (WebCore::CCPrioritizedTextureManager::requestLate): 35 (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): 36 (WebCore::CCPrioritizedTextureManager::reduceMemory): 37 (WebCore::CCPrioritizedTextureManager::returnBackingTexture): 38 (WebCore::CCPrioritizedTextureManager::destroyBacking): 39 (WebCore::CCPrioritizedTextureManager::assertInvariants): 40 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: 41 (CCPrioritizedTextureManager): 42 1 43 2012-09-11 Adam Barth <abarth@webkit.org> 2 44 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.cpp
r126473 r128253 29 29 #include "CCPrioritizedTextureManager.h" 30 30 #include "CCPriorityCalculator.h" 31 #include "CCProxy.h" 31 32 #include <algorithm> 32 33 … … 140 141 } 141 142 143 CCPrioritizedTexture::Backing::Backing(unsigned id, IntSize size, GC3Denum format) 144 : CCTexture(id, size, format) 145 , m_owner(0) 146 , m_priorityAtLastPriorityUpdate(CCPriorityCalculator::lowestPriority()) 147 , m_ownerExistedAtLastPriorityUpdate(false) 148 , m_wasAbovePriorityCutoffAtLastPriorityUpdate(false) 149 { 150 } 151 152 CCPrioritizedTexture::Backing::~Backing() 153 { 154 ASSERT(!m_owner); 155 } 156 157 void CCPrioritizedTexture::Backing::updatePriority() 158 { 159 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 160 if (m_owner) { 161 m_ownerExistedAtLastPriorityUpdate = true; 162 m_priorityAtLastPriorityUpdate = m_owner->requestPriority(); 163 m_wasAbovePriorityCutoffAtLastPriorityUpdate = m_owner->isAbovePriorityCutoff(); 164 } else { 165 m_ownerExistedAtLastPriorityUpdate = false; 166 m_priorityAtLastPriorityUpdate = CCPriorityCalculator::lowestPriority(); 167 m_wasAbovePriorityCutoffAtLastPriorityUpdate = false; 168 } 169 } 170 142 171 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTexture.h
r125932 r128253 101 101 private: 102 102 friend class CCPrioritizedTextureManager; 103 friend class CCPrioritizedTextureTest; 103 104 104 105 class Backing : public CCTexture { 105 106 WTF_MAKE_NONCOPYABLE(Backing); 106 107 public: 107 Backing(unsigned id, IntSize size, GC3Denum format)108 : CCTexture(id, size, format), m_owner(0) { }109 ~Backing() { ASSERT(!m_owner); }108 Backing(unsigned id, IntSize, GC3Denum format); 109 ~Backing(); 110 void updatePriority(); 110 111 111 112 CCPrioritizedTexture* owner() { return m_owner; } 113 bool hadOwnerAtLastPriorityUpdate() const { return m_ownerExistedAtLastPriorityUpdate; } 114 bool requestPriorityAtLastPriorityUpdate() const { return m_priorityAtLastPriorityUpdate; } 115 bool wasAbovePriorityCutoffAtLastPriorityUpdate() const { return m_wasAbovePriorityCutoffAtLastPriorityUpdate; } 116 112 117 private: 113 118 friend class CCPrioritizedTexture; 114 119 CCPrioritizedTexture* m_owner; 120 int m_priorityAtLastPriorityUpdate; 121 bool m_ownerExistedAtLastPriorityUpdate; 122 bool m_wasAbovePriorityCutoffAtLastPriorityUpdate; 115 123 }; 116 124 … … 129 137 size_t m_bytes; 130 138 131 size_t m_priority;139 int m_priority; 132 140 bool m_isAbovePriorityCutoff; 133 141 bool m_isSelfManaged; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
r128005 r128253 43 43 , m_memoryAvailableBytes(0) 44 44 , m_pool(pool) 45 , m_needsUpdateBackingsPrioritites(false) 45 46 { 46 47 } … … 62 63 ASSERT(CCProxy::isMainThread()); 63 64 64 #if !ASSERT_DISABLED65 assertInvariants();66 #endif67 68 65 // Sorting textures in this function could be replaced by a slightly 69 66 // modified O(n) quick-select to partition textures rather than … … 71 68 72 69 TextureVector& sortedTextures = m_tempTextureVector; 73 BackingVector& sortedBackings = m_tempBackingVector;74 70 sortedTextures.clear(); 75 sortedBackings.clear();76 71 77 72 // Copy all textures into a vector and sort them. … … 117 112 m_memoryAboveCutoffBytes += (*it)->bytes(); 118 113 } 114 sortedTextures.clear(); 115 116 m_needsUpdateBackingsPrioritites = true; 117 119 118 ASSERT(m_memoryAboveCutoffBytes <= m_memoryAvailableBytes); 120 121 // Put backings in eviction/recycling order. 122 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) 119 ASSERT(memoryAboveCutoffBytes() <= maxMemoryLimitBytes()); 120 } 121 122 void CCPrioritizedTextureManager::updateBackingsPriorities() 123 { 124 TRACE_EVENT0("cc", "CCPrioritizedTextureManager::updateBackingsPriorities"); 125 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 126 127 if (!m_needsUpdateBackingsPrioritites) 128 return; 129 130 #if !ASSERT_DISABLED 131 assertInvariants(); 132 #endif 133 134 // Update backings' priorities and put backings in eviction/recycling order. 135 BackingVector& sortedBackings = m_tempBackingVector; 136 sortedBackings.clear(); 137 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { 138 (*it)->updatePriority(); 123 139 sortedBackings.append(*it); 140 } 124 141 std::sort(sortedBackings.begin(), sortedBackings.end(), compareBackings); 125 142 … … 128 145 m_backings.add(*it); 129 146 } 130 131 sortedTextures.clear();132 147 sortedBackings.clear(); 148 m_needsUpdateBackingsPrioritites = false; 133 149 134 150 #if !ASSERT_DISABLED 135 151 assertInvariants(); 136 ASSERT(memoryAboveCutoffBytes() <= maxMemoryLimitBytes());137 152 #endif 138 153 } … … 167 182 m_memoryAboveCutoffBytes = newMemoryBytes; 168 183 texture->setAbovePriorityCutoff(true); 169 if (texture->backing()) { 170 m_backings.remove(texture->backing()); 171 m_backings.add(texture->backing()); 172 } 184 m_needsUpdateBackingsPrioritites = true; 173 185 return true; 174 186 } … … 182 194 return; 183 195 196 // Make sure that the backings list is up to date and sorted before traversing it. 197 updateBackingsPriorities(); 198 184 199 // Find a backing below, by either recycling or allocating. 185 200 CCPrioritizedTexture::Backing* backing = 0; … … 187 202 // First try to recycle 188 203 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { 189 if ((*it)-> owner() && (*it)->owner()->isAbovePriorityCutoff())204 if ((*it)->hadOwnerAtLastPriorityUpdate() && (*it)->wasAbovePriorityCutoffAtLastPriorityUpdate()) 190 205 break; 191 206 if ((*it)->size() == texture->size() && (*it)->format() == texture->format()) { … … 207 222 m_backings.remove(backing); 208 223 m_backings.add(backing); 224 225 // Update the backing's priority from its new owner. 226 backing->updatePriority(); 209 227 } 210 228 … … 218 236 while (memoryUseBytes() > limitBytes && m_backings.size() > 0) { 219 237 BackingSet::iterator it = m_backings.begin(); 220 if ((*it)-> owner() && (*it)->owner()->isAbovePriorityCutoff())238 if ((*it)->hadOwnerAtLastPriorityUpdate() && (*it)->wasAbovePriorityCutoffAtLastPriorityUpdate()) 221 239 break; 222 240 destroyBacking((*it), resourceProvider); … … 227 245 { 228 246 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 247 248 // Make sure that the backings list is up to date and sorted before traversing it. 249 updateBackingsPriorities(); 250 229 251 reduceMemory(m_memoryAvailableBytes, resourceProvider); 230 252 ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); … … 309 331 ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); 310 332 if (texture->backing()) { 311 // Move the backing texture to the front for eviction/recycling and unlink it.312 m_backings.remove(texture->backing());313 m_backings.insertBefore(m_backings.begin(), texture->backing());314 333 texture->unlink(); 334 m_needsUpdateBackingsPrioritites = true; 315 335 } 316 336 } … … 330 350 void CCPrioritizedTextureManager::destroyBacking(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider) 331 351 { 352 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 332 353 ASSERT(backing); 333 354 ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff()); … … 345 366 } 346 367 347 348 368 #if !ASSERT_DISABLED 349 369 void CCPrioritizedTextureManager::assertInvariants() 350 370 { 351 ASSERT(CCProxy::is MainThread());371 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 352 372 353 373 // If we hit any of these asserts, there is a bug in this class. To see … … 372 392 // backings that can't be evicted in the backing texture list (otherwise 373 393 // reduceMemory will not find all textures available for eviction/recycling). 374 bool reachedProtected = false; 394 bool reachedOwned = false; 395 bool reachedAboveCutoff = false; 375 396 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) { 376 if ((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()) 377 reachedProtected = true; 378 if (reachedProtected) 379 ASSERT((*it)->owner() && (*it)->owner()->isAbovePriorityCutoff()); 397 if ((*it)->hadOwnerAtLastPriorityUpdate()) 398 reachedOwned = true; 399 if ((*it)->wasAbovePriorityCutoffAtLastPriorityUpdate()) 400 reachedAboveCutoff = true; 401 if (reachedOwned) 402 ASSERT((*it)->hadOwnerAtLastPriorityUpdate()); 403 if (reachedAboveCutoff) { 404 ASSERT((*it)->hadOwnerAtLastPriorityUpdate() && (*it)->wasAbovePriorityCutoffAtLastPriorityUpdate()); 405 ASSERT(reachedOwned); 406 } 380 407 } 381 408 } 382 409 #endif 383 410 384 385 411 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
r128005 r128253 88 88 void returnBackingTexture(CCPrioritizedTexture*); 89 89 90 #if !ASSERT_DISABLED 91 void assertInvariants(); 92 #endif 90 private: 91 friend class CCPrioritizedTextureTest; 93 92 94 private:95 93 // Compare textures. Highest priority first. 96 94 static inline bool compareTextures(CCPrioritizedTexture* a, CCPrioritizedTexture* b) … … 103 101 static inline bool compareBackings(CCPrioritizedTexture::Backing* a, CCPrioritizedTexture::Backing* b) 104 102 { 105 int priorityA = a->owner() ? a->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); 106 int priorityB = b->owner() ? b->owner()->requestPriority() : CCPriorityCalculator::lowestPriority(); 107 if (priorityA == priorityB) 108 return a < b; 109 return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); 103 int priorityA = a->requestPriorityAtLastPriorityUpdate(); 104 int priorityB = b->requestPriorityAtLastPriorityUpdate(); 105 if (priorityA != priorityB) 106 return CCPriorityCalculator::priorityIsLower(priorityA, priorityB); 107 bool aboveCutoffA = a->wasAbovePriorityCutoffAtLastPriorityUpdate(); 108 bool aboveCutoffB = b->wasAbovePriorityCutoffAtLastPriorityUpdate(); 109 if (!aboveCutoffA && aboveCutoffB) 110 return true; 111 if (aboveCutoffA && !aboveCutoffB) 112 return false; 113 return a < b; 110 114 } 111 115 112 116 CCPrioritizedTextureManager(size_t maxMemoryLimitBytes, int maxTextureSize, int pool); 113 117 118 void updateBackingsPriorities(); 114 119 void reduceMemory(size_t limit, CCResourceProvider*); 115 116 120 CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*); 117 121 void destroyBacking(CCPrioritizedTexture::Backing*, CCResourceProvider*); 122 123 #if !ASSERT_DISABLED 124 void assertInvariants(); 125 #endif 118 126 119 127 size_t m_maxMemoryLimitBytes; … … 134 142 TextureVector m_tempTextureVector; 135 143 BackingVector m_tempBackingVector; 144 145 // Set by the main thread when it adjust priorities in such a way that 146 // the m_backings array's view of priorities is now out of date. 147 bool m_needsUpdateBackingsPrioritites; 136 148 }; 137 149 -
trunk/Source/WebKit/chromium/ChangeLog
r128218 r128253 1 2012-09-11 Christopher Cameron <ccameron@chromium.org> 2 3 [chromium] Make prioritized texture manager not touch backings array on the main thread 4 https://bugs.webkit.org/show_bug.cgi?id=96114 5 6 Reviewed by James Robinson. 7 8 Take a snapshot of the textures' priorities from the main thread, 9 and save it in their backings for access by the impl thread. 10 Update functions that access the sorted backings array to use the 11 snapshotted values instead of the values that the main thread may 12 have computed for the next frame. 13 14 Make the main thread not touch the m_backings array. Split 15 prioritizeTextures into a updateBackingsPriorities function. 16 In places where the main thread would have touched m_backings, 17 set a flag specifying that m_backings needs to be re-sorted 18 before any function that requires it be sorted by priority be 19 executed. 20 21 Update the two functions that require sorted order (acquireBacking 22 and reduceMemory) to sort the backings array (if needed) before 23 traversing it. 24 25 Updated tests to set correct thread during asserts. Add a test to 26 verify that requestLate is correctly incorporated into the backing 27 sorting. 28 29 * tests/CCPrioritizedTextureTest.cpp: 30 (WTF::CCPrioritizedTextureTest::validateTexture): 31 1 32 2012-09-11 Sheriff Bot <webkit.review.bot@gmail.com> 2 33 -
trunk/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp
r127794 r128253 39 39 using namespace WTF; 40 40 41 namespace {41 namespace WebCore { 42 42 43 43 class CCPrioritizedTextureTest : public testing::Test { … … 71 71 bool validateTexture(OwnPtr<CCPrioritizedTexture>& texture, bool requestLate) 72 72 { 73 #if !ASSERT_DISABLED 74 texture->textureManager()->assertInvariants(); 75 #endif 73 textureManagerAssertInvariants(texture->textureManager()); 76 74 if (requestLate) 77 75 texture->requestLate(); 76 textureManagerAssertInvariants(texture->textureManager()); 78 77 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; 79 78 bool success = texture->canAcquireBackingTexture(); … … 83 82 } 84 83 84 void prioritizeTexturesAndBackings(CCPrioritizedTextureManager* textureManager) 85 { 86 textureManager->prioritizeTextures(); 87 textureManagerUpdateBackingsPriorities(textureManager); 88 } 89 90 void textureManagerUpdateBackingsPriorities(CCPrioritizedTextureManager* textureManager) 91 { 92 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; 93 textureManager->updateBackingsPriorities(); 94 } 95 85 96 CCResourceProvider* resourceProvider() 86 97 { 87 98 return m_resourceProvider.get(); 99 } 100 101 void textureManagerAssertInvariants(CCPrioritizedTextureManager* textureManager) 102 { 103 #if !ASSERT_DISABLED 104 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; 105 textureManager->assertInvariants(); 106 #endif 107 } 108 109 bool textureBackingIsAbovePriorityCutoff(CCPrioritizedTexture* texture) 110 { 111 return texture->m_backing->wasAbovePriorityCutoffAtLastPriorityUpdate(); 88 112 } 89 113 … … 96 120 }; 97 121 122 } 123 124 namespace { 125 98 126 TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) 99 127 { … … 112 140 113 141 // Only lower half should be available. 114 textureManager->prioritizeTextures();142 prioritizeTexturesAndBackings(textureManager.get()); 115 143 EXPECT_TRUE(validateTexture(textures[0], false)); 116 144 EXPECT_TRUE(validateTexture(textures[7], false)); … … 123 151 124 152 // Only upper half should be available. 125 textureManager->prioritizeTextures();153 prioritizeTexturesAndBackings(textureManager.get()); 126 154 EXPECT_FALSE(validateTexture(textures[0], false)); 127 155 EXPECT_FALSE(validateTexture(textures[7], false)); … … 149 177 // Set max limit to 8 textures 150 178 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); 151 textureManager->prioritizeTextures();179 prioritizeTexturesAndBackings(textureManager.get()); 152 180 for (size_t i = 0; i < maxTextures; ++i) 153 181 validateTexture(textures[i], false); … … 162 190 // Set max limit to 5 textures 163 191 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); 164 textureManager->prioritizeTextures();192 prioritizeTexturesAndBackings(textureManager.get()); 165 193 for (size_t i = 0; i < maxTextures; ++i) 166 194 EXPECT_EQ(validateTexture(textures[i], false), i < 5); … … 175 203 // Set max limit to 4 textures 176 204 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); 177 textureManager->prioritizeTextures();205 prioritizeTexturesAndBackings(textureManager.get()); 178 206 for (size_t i = 0; i < maxTextures; ++i) 179 207 EXPECT_EQ(validateTexture(textures[i], false), i < 4); … … 205 233 for (size_t i = 0; i < numTextures; ++i) 206 234 textures[i]->setRequestPriority(200 + i); 207 textureManager->prioritizeTextures();235 prioritizeTexturesAndBackings(textureManager.get()); 208 236 209 237 // Allocate textures which are currently high priority. … … 220 248 for (size_t i = 0; i < numTextures; ++i) 221 249 moreTextures[i]->setRequestPriority(100 + i); 222 textureManager->prioritizeTextures();250 prioritizeTexturesAndBackings(textureManager.get()); 223 251 224 252 // Textures are now below cutoff. … … 267 295 // Set max limit to 8 textures 268 296 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); 269 textureManager->prioritizeTextures();297 prioritizeTexturesAndBackings(textureManager.get()); 270 298 271 299 // The two high priority textures should be available, others should not. … … 299 327 300 328 texture->setRequestPriority(100); 301 textureManager->prioritizeTextures();329 prioritizeTexturesAndBackings(textureManager.get()); 302 330 303 331 EXPECT_TRUE(validateTexture(texture, false)); … … 325 353 326 354 texture->setRequestPriority(100); 327 textureManagerOne->prioritizeTextures();355 prioritizeTexturesAndBackings(textureManagerOne.get()); 328 356 329 357 EXPECT_TRUE(validateTexture(texture, false)); … … 344 372 texture->setTextureManager(textureManagerTwo.get()); 345 373 346 textureManagerTwo->prioritizeTextures();374 prioritizeTexturesAndBackings(textureManagerTwo.get()); 347 375 348 376 EXPECT_TRUE(validateTexture(texture, false)); … … 375 403 376 404 // Only lower half should be available. 377 textureManager->prioritizeTextures();405 prioritizeTexturesAndBackings(textureManager.get()); 378 406 EXPECT_TRUE(validateTexture(textures[0], false)); 379 407 EXPECT_TRUE(validateTexture(textures[3], false)); … … 386 414 387 415 // Only upper half should be available. 388 textureManager->prioritizeTextures();416 prioritizeTexturesAndBackings(textureManager.get()); 389 417 EXPECT_FALSE(validateTexture(textures[0], false)); 390 418 EXPECT_FALSE(validateTexture(textures[3], false)); … … 421 449 422 450 // The first four to be requested late will be available. 423 textureManager->prioritizeTextures();451 prioritizeTexturesAndBackings(textureManager.get()); 424 452 for (unsigned i = 0; i < maxTextures; ++i) 425 453 EXPECT_FALSE(validateTexture(textures[i], false)); … … 459 487 textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(false)); 460 488 461 textureManager->prioritizeTextures();489 prioritizeTexturesAndBackings(textureManager.get()); 462 490 463 491 // Unable to requestLate textures in the child surface. … … 477 505 } 478 506 507 TEST_F(CCPrioritizedTextureTest, requestLateBackingsSorting) 508 { 509 const size_t maxTextures = 8; 510 OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); 511 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); 512 513 // Create textures to fill our memory limit. 514 OwnPtr<CCPrioritizedTexture> textures[maxTextures]; 515 for (size_t i = 0; i < maxTextures; ++i) 516 textures[i] = textureManager->createTexture(m_textureSize, m_textureFormat); 517 518 // Set equal priorities, and allocate backings for all textures. 519 for (size_t i = 0; i < maxTextures; ++i) 520 textures[i]->setRequestPriority(100); 521 prioritizeTexturesAndBackings(textureManager.get()); 522 for (unsigned i = 0; i < maxTextures; ++i) 523 EXPECT_TRUE(validateTexture(textures[i], false)); 524 525 // Drop the memory limit and prioritize (none will be above the threshold, 526 // but they still have backings because reduceMemory hasn't been called). 527 textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures / 2)); 528 prioritizeTexturesAndBackings(textureManager.get()); 529 530 // Push half of them back over the limit. 531 for (size_t i = 0; i < maxTextures; i += 2) 532 EXPECT_TRUE(textures[i]->requestLate()); 533 534 // Push the priorities to the backings array and sort the backings array 535 textureManagerUpdateBackingsPriorities(textureManager.get()); 536 537 // Assert that the backings list be sorted with the below-limit backings 538 // before the above-limit backings. 539 textureManagerAssertInvariants(textureManager.get()); 540 541 // Make sure that we have backings for all of the textures. 542 for (size_t i = 0; i < maxTextures; ++i) 543 EXPECT_TRUE(textures[i]->haveBackingTexture()); 544 545 // Make sure that only the requestLate textures are above the priority cutoff 546 for (size_t i = 0; i < maxTextures; i += 2) 547 EXPECT_TRUE(textureBackingIsAbovePriorityCutoff(textures[i].get())); 548 for (size_t i = 1; i < maxTextures; i += 2) 549 EXPECT_FALSE(textureBackingIsAbovePriorityCutoff(textures[i].get())); 550 551 DebugScopedSetImplThreadAndMainThreadBlocked implThreadAndMainThreadBlocked; 552 textureManager->clearAllMemory(resourceProvider()); 553 } 554 555 479 556 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.