Changeset 128344 in webkit
- Timestamp:
- Sep 12, 2012 11:49:25 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r128341 r128344 1 2012-09-12 Christopher Cameron <ccameron@chromium.org> 2 3 [chromium] Evict textures through the texture manager instead of the resource provider 4 https://bugs.webkit.org/show_bug.cgi?id=96463 5 6 Reviewed by James Robinson. 7 8 When deleting contents textures' resources on the impl thread, do the 9 deletion through the CCPrioritizedTextureManager instead of the 10 CCResourceProvider. 11 12 This requires traversing the backings list on the impl thread while 13 the main thread is running, so remove the one remaining traversal of 14 the backings list by the main thread. This traversal happens when 15 unlinking textures that were evicted by the impl thread, so explicitly 16 send the list of evicted backings from the impl thread to the main thread. 17 18 Unify all resource deletion paths in the CCPrioritizedTextureManager. 19 Always perform the sequence of eviction (deleting the GL resource) and 20 then destruction of evicted backings (deleting the objects). Also, 21 use the same function (evictBackingsToReduceMemory) to reduce memory 22 consumption both during commit and when done by the impl thread in response 23 to a request by the GPU memory manager. 24 25 Note that destroying only some of the resources at a time during texture 26 eviction (as opposed all resources) is still not supported because the 27 texture upload queues cannot be only-partially invalidated yet. 28 29 Updated tests to take this behavior into account. 30 31 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 32 (WebCore::CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread): 33 (WebCore): 34 (WebCore::CCLayerTreeHost::getEvictedContentTexturesBackings): 35 (WebCore::CCLayerTreeHost::unlinkEvictedContentTexturesBackings): 36 (WebCore::CCLayerTreeHost::deleteEvictedContentTexturesBackings): 37 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 38 (CCLayerTreeHost): 39 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 40 (WebCore::CCLayerTreeHostImpl::releaseContentsTextures): 41 (WebCore::CCLayerTreeHostImpl::setContentsTexturesPurged): 42 (WebCore): 43 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: 44 (CCLayerTreeHostImplClient): 45 (CCLayerTreeHostImpl): 46 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp: 47 (WebCore::CCPrioritizedTextureManager::~CCPrioritizedTextureManager): 48 (WebCore::CCPrioritizedTextureManager::acquireBackingTextureIfNeeded): 49 (WebCore::CCPrioritizedTextureManager::evictBackingsToReduceMemory): 50 (WebCore::CCPrioritizedTextureManager::reduceMemory): 51 (WebCore::CCPrioritizedTextureManager::clearAllMemory): 52 (WebCore::CCPrioritizedTextureManager::reduceMemoryOnImplThread): 53 (WebCore::CCPrioritizedTextureManager::getEvictedBackings): 54 (WebCore::CCPrioritizedTextureManager::unlinkEvictedBackings): 55 (WebCore): 56 (WebCore::CCPrioritizedTextureManager::deleteEvictedBackings): 57 (WebCore::CCPrioritizedTextureManager::evictBackingResource): 58 * platform/graphics/chromium/cc/CCPrioritizedTextureManager.h: 59 (CCPrioritizedTextureManager): 60 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 61 (WebCore::CCSingleThreadProxy::releaseContentsTexturesOnImplThread): 62 (WebCore): 63 (WebCore::CCSingleThreadProxy::commitAndComposite): 64 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 65 * platform/graphics/chromium/cc/CCThreadProxy.cpp: 66 (WebCore::CCThreadProxy::releaseContentsTexturesOnImplThread): 67 (WebCore): 68 (WebCore::CCThreadProxy::scheduledActionBeginFrame): 69 (WebCore::CCThreadProxy::beginFrame): 70 (WebCore::CCThreadProxy::beginFrameCompleteOnImplThread): 71 (WebCore::CCThreadProxy::layerTreeHostClosedOnImplThread): 72 (WebCore::CCThreadProxy::recreateContextOnImplThread): 73 * platform/graphics/chromium/cc/CCThreadProxy.h: 74 (BeginFrameAndCommitState): 75 (CCThreadProxy): 76 1 77 2012-09-12 Mike Fenton <mifenton@rim.com> 2 78 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r128005 r128344 415 415 } 416 416 417 void CCLayerTreeHost::unlinkAllContentTextures() 417 void CCLayerTreeHost::reduceContentsTexturesMemoryOnImplThread(size_t limitBytes, CCResourceProvider* resourceProvider) 418 { 419 ASSERT(CCProxy::isImplThread()); 420 ASSERT(m_contentsTextureManager.get()); 421 m_contentsTextureManager->reduceMemoryOnImplThread(limitBytes, resourceProvider); 422 } 423 424 void CCLayerTreeHost::getEvictedContentTexturesBackings(CCPrioritizedTextureManager::BackingVector& evictedBackings) 425 { 426 ASSERT(CCProxy::isImplThread()); 427 evictedBackings.clear(); 428 if (m_rendererInitialized) 429 m_contentsTextureManager->getEvictedBackings(evictedBackings); 430 } 431 432 void CCLayerTreeHost::unlinkEvictedContentTexturesBackings(const CCPrioritizedTextureManager::BackingVector& evictedBackings) 418 433 { 419 434 ASSERT(CCProxy::isMainThread()); 420 435 ASSERT(m_contentsTextureManager.get()); 421 m_contentsTextureManager->unlink AllBackings();422 } 423 424 void CCLayerTreeHost::deleteUnlinkedTextures()436 m_contentsTextureManager->unlinkEvictedBackings(evictedBackings); 437 } 438 439 bool CCLayerTreeHost::deleteEvictedContentTexturesBackings() 425 440 { 426 441 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 427 442 ASSERT(m_contentsTextureManager.get()); 428 m_contentsTextureManager->deleteAllUnlinkedBackings();443 return m_contentsTextureManager->deleteEvictedBackings(); 429 444 } 430 445 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r128005 r128344 212 212 CCPrioritizedTextureManager* contentsTextureManager() const; 213 213 214 void unlinkAllContentTextures(); 215 void deleteUnlinkedTextures(); 214 // Delete contents textures' backing resources until they use only bytesLimit bytes. This may 215 // be called on the impl thread while the main thread is running. 216 void reduceContentsTexturesMemoryOnImplThread(size_t bytesLimit, CCResourceProvider*); 217 // Retrieve the list of all contents textures' backings that have been evicted, to pass to the 218 // main thread to unlink them from their owning textures. 219 void getEvictedContentTexturesBackings(CCPrioritizedTextureManager::BackingVector&); 220 // Unlink the list of contents textures' backings from their owning textures on the main thread 221 // before updating layers. 222 void unlinkEvictedContentTexturesBackings(const CCPrioritizedTextureManager::BackingVector&); 223 // Deletes all evicted backings, unlinking them from their owning textures if needed. 224 // Returns true if this function had to unlink any backings from their owning texture when 225 // destroying them. If this was the case, the impl layer tree may contain invalid resources. 226 bool deleteEvictedContentTexturesBackings(); 216 227 217 228 bool visible() const { return m_visible; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r127907 r128344 522 522 if (m_contentsTexturesPurged) 523 523 return; 524 m_ resourceProvider->deleteOwnedResources(CCRenderer::ContentPool);525 m_contentsTexturesPurged = true;524 m_client->releaseContentsTexturesOnImplThread(); 525 setContentsTexturesPurged(); 526 526 m_client->setNeedsCommitOnImplThread(); 527 527 m_client->onCanDrawStateChanged(canDraw()); … … 732 732 733 733 return m_renderer; 734 } 735 736 void CCLayerTreeHostImpl::setContentsTexturesPurged() 737 { 738 m_contentsTexturesPurged = true; 739 m_client->onCanDrawStateChanged(canDraw()); 734 740 } 735 741 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r127891 r128344 61 61 virtual void setNeedsCommitOnImplThread() = 0; 62 62 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) = 0; 63 virtual void releaseContentsTexturesOnImplThread() = 0; 63 64 }; 64 65 … … 158 159 159 160 bool contentsTexturesPurged() const { return m_contentsTexturesPurged; } 161 void setContentsTexturesPurged(); 160 162 void resetContentsTexturesPurged(); 161 163 size_t memoryAllocationLimitBytes() const { return m_memoryAllocationLimitBytes; } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.cpp
r128253 r128344 52 52 unregisterTexture(*m_textures.begin()); 53 53 54 // Each remaining backing is a leaked opengl texture. We don't have the resourceProvider55 // to delete the textures at this time so clearMemory() needs to be called before this. 56 while (m_backings.size() > 0)57 destroyBacking(*m_backings.begin(), 0);54 deleteEvictedBackings(); 55 56 // Each remaining backing is a leaked opengl texture. There should be none. 57 ASSERT(m_backings.isEmpty()); 58 58 } 59 59 … … 212 212 // Otherwise reduce memory and just allocate a new backing texures. 213 213 if (!backing) { 214 reduceMemory(m_memoryAvailableBytes - texture->bytes(), resourceProvider);214 evictBackingsToReduceMemory(m_memoryAvailableBytes - texture->bytes(), RespectManagerPriorityCutoff, resourceProvider); 215 215 backing = createBacking(texture->size(), texture->format(), resourceProvider); 216 216 } … … 227 227 } 228 228 229 void CCPrioritizedTextureManager:: reduceMemory(size_t limitBytes, CCResourceProvider* resourceProvider)230 { 231 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());229 void CCPrioritizedTextureManager::evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy evictionPolicy, CCResourceProvider* resourceProvider) 230 { 231 ASSERT(CCProxy::isImplThread()); 232 232 if (memoryUseBytes() <= limitBytes) 233 233 return; 234 234 235 // Destroy backings until we are below the limit, 235 236 // or until all backings remaining are above the cutoff. 236 237 while (memoryUseBytes() > limitBytes && m_backings.size() > 0) { 237 BackingSet::iterator it = m_backings.begin(); 238 if ((*it)->hadOwnerAtLastPriorityUpdate() && (*it)->wasAbovePriorityCutoffAtLastPriorityUpdate()) 239 break; 240 destroyBacking((*it), resourceProvider); 238 CCPrioritizedTexture::Backing* backing = *m_backings.begin(); 239 if (evictionPolicy == RespectManagerPriorityCutoff) 240 if (backing->hadOwnerAtLastPriorityUpdate() && backing->wasAbovePriorityCutoffAtLastPriorityUpdate()) 241 break; 242 evictBackingResource(backing, resourceProvider); 241 243 } 242 244 } … … 249 251 updateBackingsPriorities(); 250 252 251 reduceMemory(m_memoryAvailableBytes, resourceProvider);253 evictBackingsToReduceMemory(m_memoryAvailableBytes, RespectManagerPriorityCutoff, resourceProvider); 252 254 ASSERT(memoryUseBytes() <= maxMemoryLimitBytes()); 253 255 … … 264 266 } 265 267 size_t tenPercentOfMemory = m_memoryAvailableBytes / 10; 266 if (wastedMemory <= tenPercentOfMemory) 267 return; 268 reduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), resourceProvider); 268 if (wastedMemory > tenPercentOfMemory) 269 evictBackingsToReduceMemory(memoryUseBytes() - (wastedMemory - tenPercentOfMemory), RespectManagerPriorityCutoff, resourceProvider); 270 271 deleteEvictedBackings(); 269 272 } 270 273 … … 273 276 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 274 277 ASSERT(resourceProvider); 275 // Unlink and destroy all backing textures. 276 while (m_backings.size() > 0) { 277 BackingSet::iterator it = m_backings.begin(); 278 if ((*it)->owner()) 279 (*it)->owner()->unlink(); 280 destroyBacking((*it), resourceProvider); 281 } 282 } 283 284 void CCPrioritizedTextureManager::unlinkAllBackings() 278 evictBackingsToReduceMemory(0, DoNotRespectManagerPriorityCutoff, resourceProvider); 279 deleteEvictedBackings(); 280 } 281 282 void CCPrioritizedTextureManager::reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider* resourceProvider) 283 { 284 ASSERT(CCProxy::isImplThread()); 285 ASSERT(resourceProvider); 286 287 evictBackingsToReduceMemory(limitBytes, DoNotRespectManagerPriorityCutoff, resourceProvider); 288 289 // Deleting just some (not all) resources is not supported yet because we do not clear 290 // only the deleted resources from the texture upload queues (rather, we clear all uploads). 291 // Make sure that if we evict all resources. 292 ASSERT(m_backings.isEmpty()); 293 } 294 295 void CCPrioritizedTextureManager::getEvictedBackings(BackingVector& evictedBackings) 296 { 297 ASSERT(CCProxy::isImplThread()); 298 evictedBackings.clear(); 299 evictedBackings.append(m_evictedBackings); 300 } 301 302 void CCPrioritizedTextureManager::unlinkEvictedBackings(const BackingVector& evictedBackings) 285 303 { 286 304 ASSERT(CCProxy::isMainThread()); 287 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) 288 if ((*it)->owner()) 289 (*it)->owner()->unlink(); 290 } 291 292 void CCPrioritizedTextureManager::deleteAllUnlinkedBackings() 293 { 294 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked()); 295 BackingVector backingsToDelete; 296 for (BackingSet::iterator it = m_backings.begin(); it != m_backings.end(); ++it) 297 if (!(*it)->owner()) 298 backingsToDelete.append((*it)); 299 300 for (BackingVector::iterator it = backingsToDelete.begin(); it != backingsToDelete.end(); ++it) 301 destroyBacking((*it), 0); 305 for (BackingVector::const_iterator it = evictedBackings.begin(); it != evictedBackings.end(); ++it) { 306 CCPrioritizedTexture::Backing* backing = (*it); 307 if (backing->owner()) 308 backing->owner()->unlink(); 309 } 310 } 311 312 bool CCPrioritizedTextureManager::deleteEvictedBackings() 313 { 314 ASSERT(CCProxy::isMainThread() || (CCProxy::isImplThread() && CCProxy::isMainThreadBlocked())); 315 bool linkedEvictedBackingsExisted = false; 316 for (BackingVector::const_iterator it = m_evictedBackings.begin(); it != m_evictedBackings.end(); ++it) { 317 CCPrioritizedTexture::Backing* backing = (*it); 318 if (backing->owner()) { 319 linkedEvictedBackingsExisted = true; 320 backing->owner()->unlink(); 321 } 322 delete backing; 323 } 324 m_evictedBackings.clear(); 325 return linkedEvictedBackingsExisted; 302 326 } 303 327 … … 348 372 } 349 373 350 void CCPrioritizedTextureManager:: destroyBacking(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider)351 { 352 ASSERT(CCProxy::isImplThread() && CCProxy::isMainThreadBlocked());374 void CCPrioritizedTextureManager::evictBackingResource(CCPrioritizedTexture::Backing* backing, CCResourceProvider* resourceProvider) 375 { 376 ASSERT(CCProxy::isImplThread()); 353 377 ASSERT(backing); 354 ASSERT(!backing->owner() || !backing->owner()->isAbovePriorityCutoff()); 355 ASSERT(!backing->owner() || !backing->owner()->isSelfManaged()); 378 ASSERT(resourceProvider); 356 379 ASSERT(m_backings.find(backing) != m_backings.end()); 357 380 358 if (resourceProvider) 359 resourceProvider->deleteResource(backing->id()); 360 if (backing->owner()) 361 backing->owner()->unlink(); 381 resourceProvider->deleteResource(backing->id()); 382 backing->setId(0); 362 383 m_memoryUseBytes -= backing->bytes(); 363 384 m_backings.remove(backing); 364 365 delete backing; 385 m_evictedBackings.append(backing); 366 386 } 367 387 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCPrioritizedTextureManager.h
r128253 r128344 54 54 ~CCPrioritizedTextureManager(); 55 55 56 typedef Vector<CCPrioritizedTexture::Backing*> BackingVector; 57 56 58 // FIXME (http://crbug.com/137094): This 64MB default is a straggler from the 57 59 // old texture manager and is just to give us a default memory allocation before … … 75 77 void clearPriorities(); 76 78 79 void reduceMemoryOnImplThread(size_t limitBytes, CCResourceProvider*); 80 void getEvictedBackings(BackingVector& evictedBackings); 81 void unlinkEvictedBackings(const BackingVector& evictedBackings); 82 // Deletes all evicted backings, unlinking them from their owning textures if needed. 83 // Returns true if this function to unlinked any backings from their owning texture while 84 // destroying them. 85 bool deleteEvictedBackings(); 86 77 87 bool requestLate(CCPrioritizedTexture*); 78 88 79 89 void reduceMemory(CCResourceProvider*); 80 90 void clearAllMemory(CCResourceProvider*); 81 void unlinkAllBackings();82 void deleteAllUnlinkedBackings();83 91 84 92 void acquireBackingTextureIfNeeded(CCPrioritizedTexture*, CCResourceProvider*); … … 90 98 private: 91 99 friend class CCPrioritizedTextureTest; 100 101 enum EvictionPriorityPolicy { 102 RespectManagerPriorityCutoff, 103 DoNotRespectManagerPriorityCutoff, 104 }; 92 105 93 106 // Compare textures. Highest priority first. … … 117 130 118 131 void updateBackingsPriorities(); 119 void reduceMemory(size_t limit, CCResourceProvider*);132 void evictBackingsToReduceMemory(size_t limitBytes, EvictionPriorityPolicy, CCResourceProvider*); 120 133 CCPrioritizedTexture::Backing* createBacking(IntSize, GC3Denum format, CCResourceProvider*); 121 void destroyBacking(CCPrioritizedTexture::Backing*, CCResourceProvider*);134 void evictBackingResource(CCPrioritizedTexture::Backing*, CCResourceProvider*); 122 135 123 136 #if !ASSERT_DISABLED … … 135 148 typedef ListHashSet<CCPrioritizedTexture::Backing*> BackingSet; 136 149 typedef Vector<CCPrioritizedTexture*> TextureVector; 137 typedef Vector<CCPrioritizedTexture::Backing*> BackingVector;138 150 139 151 TextureSet m_textures; 140 152 BackingSet m_backings; 153 BackingVector m_evictedBackings; 141 154 142 155 TextureVector m_tempTextureVector; -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r128005 r128344 276 276 } 277 277 278 void CCSingleThreadProxy::releaseContentsTexturesOnImplThread() 279 { 280 ASSERT(isImplThread()); 281 m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider()); 282 } 283 278 284 // Called by the legacy scheduling path (e.g. where render_widget does the scheduling) 279 285 void CCSingleThreadProxy::compositeImmediately() … … 301 307 return false; 302 308 303 if (m_layerTreeHostImpl->contentsTexturesPurged()) { 304 m_layerTreeHost->unlinkAllContentTextures(); 309 // Unlink any texture backings that were deleted 310 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; 311 { 312 DebugScopedSetImplThread implThread; 313 m_layerTreeHost->getEvictedContentTexturesBackings(evictedContentsTexturesBackings); 314 } 315 m_layerTreeHost->unlinkEvictedContentTexturesBackings(evictedContentsTexturesBackings); 316 { 305 317 DebugScopedSetImplThreadAndMainThreadBlocked implAndMainBlocked; 306 m_layerTreeHost->delete UnlinkedTextures();318 m_layerTreeHost->deleteEvictedContentTexturesBackings(); 307 319 } 308 320 309 321 CCTextureUpdateQueue queue; 310 322 m_layerTreeHost->updateLayers(queue, m_layerTreeHostImpl->memoryAllocationLimitBytes()); 311 m_layerTreeHostImpl->resetContentsTexturesPurged(); 323 324 if (m_layerTreeHostImpl->contentsTexturesPurged()) 325 m_layerTreeHostImpl->resetContentsTexturesPurged(); 312 326 313 327 m_layerTreeHost->willCommit(); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r127948 r128344 73 73 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_layerTreeHost->scheduleComposite(); } 74 74 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE; 75 virtual void releaseContentsTexturesOnImplThread() OVERRIDE; 75 76 76 77 // Called by the legacy path where RenderWidget does the scheduling. -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
r128005 r128344 375 375 } 376 376 377 void CCThreadProxy::releaseContentsTexturesOnImplThread() 378 { 379 ASSERT(isImplThread()); 380 m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider()); 381 // Make sure that we get a new commit before drawing again. 382 m_resetContentsTexturesPurgedAfterCommitOnImplThread = false; 383 // The texture upload queue may reference textures that were just purged, so clear it. 384 m_currentTextureUpdateControllerOnImplThread.clear(); 385 } 386 377 387 void CCThreadProxy::setNeedsRedraw() 378 388 { … … 477 487 m_pendingBeginFrameRequest->monotonicFrameBeginTime = monotonicallyIncreasingTime(); 478 488 m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas(); 479 m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesPurged();480 489 m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes(); 490 m_layerTreeHost->getEvictedContentTexturesBackings(m_pendingBeginFrameRequest->evictedContentsTexturesBackings); 481 491 482 492 m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame)); … … 549 559 } 550 560 551 if (request->contentsTexturesWereDeleted) 552 m_layerTreeHost->unlinkAllContentTextures(); 561 m_layerTreeHost->unlinkEvictedContentTexturesBackings(request->evictedContentsTexturesBackings); 553 562 554 563 OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue); … … 580 589 581 590 CCCompletionEvent completion; 582 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release() , request->contentsTexturesWereDeleted));591 CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release())); 583 592 completion.wait(); 584 593 } … … 588 597 } 589 598 590 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue , bool contentsTexturesWereDeleted)599 void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue) 591 600 { 592 601 TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); … … 602 611 } 603 612 604 if (contentsTexturesWereDeleted) { 605 ASSERT(m_layerTreeHostImpl->contentsTexturesPurged()); 606 // We unlinked all textures on the main thread, delete them now. 607 m_layerTreeHost->deleteUnlinkedTextures(); 608 // Mark that we can start drawing again when this commit is complete. 609 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 610 } else if (m_layerTreeHostImpl->contentsTexturesPurged()) { 611 // We purged the content textures on the impl thread between the time we 612 // posted the beginFrame task and now, meaning we have a bunch of 613 // uploads that are now invalid. Clear the uploads (they all go to 614 // content textures), and kick another commit to fill them again. 613 // If we unlinked evicted textures on the main thread, delete them now. 614 if (m_layerTreeHost->deleteEvictedContentTexturesBackings()) { 615 616 // Deleting the evicted textures' backings resulted in some textures in the 617 // layer tree being invalidated (unliked from their backings). The upload queue 618 // may contain references to these textures, so clear the queue and kick off 619 // another commit to fill them again. 615 620 queue->clearUploads(); 616 621 setNeedsCommitOnImplThread(); 622 } else { 623 // The layer tree does not reference evicted textures, so mark that we 624 // can draw this tree once this commit is complete. 625 if (m_layerTreeHostImpl->contentsTexturesPurged()) 626 m_resetContentsTexturesPurgedAfterCommitOnImplThread = true; 617 627 } 618 628 … … 903 913 TRACE_EVENT0("cc", "CCThreadProxy::layerTreeHostClosedOnImplThread"); 904 914 ASSERT(isImplThread()); 905 if (!m_layerTreeHostImpl->contentsTexturesPurged()) 906 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); 915 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); 907 916 m_inputHandlerOnImplThread.clear(); 908 917 m_layerTreeHostImpl.clear(); … … 926 935 TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread"); 927 936 ASSERT(isImplThread()); 928 if (!m_layerTreeHostImpl->contentsTexturesPurged()) 929 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); 937 m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->resourceProvider()); 930 938 *recreateSucceeded = m_layerTreeHostImpl->initializeRenderer(adoptPtr(contextPtr), textureUploader); 931 939 if (*recreateSucceeded) { -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r127948 r128344 82 82 virtual void setNeedsCommitOnImplThread() OVERRIDE; 83 83 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE; 84 virtual void releaseContentsTexturesOnImplThread() OVERRIDE; 84 85 85 86 // CCSchedulerClient implementation … … 107 108 double monotonicFrameBeginTime; 108 109 OwnPtr<CCScrollAndScaleSet> scrollInfo; 109 bool contentsTexturesWereDeleted;110 CCPrioritizedTextureManager::BackingVector evictedContentsTexturesBackings; 110 111 size_t memoryAllocationLimitBytes; 111 112 }; … … 128 129 }; 129 130 void forceBeginFrameOnImplThread(CCCompletionEvent*); 130 void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTextureUpdateQueue> , bool contentsTexturesWereDeleted);131 void beginFrameCompleteOnImplThread(CCCompletionEvent*, PassOwnPtr<CCTextureUpdateQueue>); 131 132 void beginFrameAbortedOnImplThread(); 132 133 void requestReadbackOnImplThread(ReadbackRequest*); -
trunk/Source/WebKit/chromium/ChangeLog
r128300 r128344 1 2012-09-12 Christopher Cameron <ccameron@chromium.org> 2 3 [chromium] Evict textures through the texture manager instead of the resource provider 4 https://bugs.webkit.org/show_bug.cgi?id=96463 5 6 Reviewed by James Robinson. 7 8 Update layer tree host impl test to include the extra interface functions 9 added to CCLayerTreeHostImplClient. 10 11 * tests/CCLayerTreeHostImplTest.cpp: 12 1 13 2012-09-12 Ilya Tikhonovsky <loislo@chromium.org> 2 14 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp
r127907 r128344 90 90 virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; } 91 91 virtual void postAnimationEventsToMainThreadOnImplThread(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime) OVERRIDE { } 92 virtual void releaseContentsTexturesOnImplThread() OVERRIDE { } 92 93 93 94 PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHost(bool partialSwap, PassOwnPtr<CCGraphicsContext> graphicsContext, PassOwnPtr<CCLayerImpl> rootPtr)
Note: See TracChangeset
for help on using the changeset viewer.