Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: cc/thread_proxy.cc

Issue 11079007: Fix issue incremental upload can evict textures being drawn (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve against The Great Renaming Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/thread_proxy.cc
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index 1d3f2d3f09d468c23ad4a03c1dc7c23eacc3588b..8ff3d93655cc5a3a1f2a3e10f3a101560e03a149 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -51,7 +51,6 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost)
, m_readbackRequestOnImplThread(0)
, m_commitCompletionEventOnImplThread(0)
, m_textureAcquisitionCompletionEventOnImplThread(0)
- , m_resetContentsTexturesPurgedAfterCommitOnImplThread(false)
, m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
, m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
, m_totalCommitCount(0)
@@ -354,13 +353,12 @@ void CCThreadProxy::releaseContentsTexturesOnImplThread()
{
ASSERT(isImplThread());
- m_layerTreeHost->reduceContentsTexturesMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider());
+ if (m_layerTreeHost->contentsTextureManager())
+ m_layerTreeHost->contentsTextureManager()->reduceMemoryOnImplThread(0, m_layerTreeHostImpl->resourceProvider());
- // Make sure that we get a new commit before drawing again.
- m_resetContentsTexturesPurgedAfterCommitOnImplThread = false;
// The texture upload queue may reference textures that were just purged, clear
// them from the queue.
- if (m_currentTextureUpdateControllerOnImplThread.get() && m_layerTreeHost->evictedContentsTexturesBackingsExist())
+ if (m_currentTextureUpdateControllerOnImplThread.get())
m_currentTextureUpdateControllerOnImplThread->discardUploadsToEvictedResources();
}
@@ -468,7 +466,8 @@ void CCThreadProxy::scheduledActionBeginFrame()
m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
m_pendingBeginFrameRequest->implTransform = m_layerTreeHostImpl->implTransform();
m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
- m_layerTreeHost->getEvictedContentTexturesBackings(m_pendingBeginFrameRequest->evictedContentsTexturesBackings);
+ if (m_layerTreeHost->contentsTextureManager())
+ m_layerTreeHost->contentsTextureManager()->getEvictedBackings(m_pendingBeginFrameRequest->evictedContentsTexturesBackings);
m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
@@ -540,7 +539,7 @@ void CCThreadProxy::beginFrame()
return;
}
- m_layerTreeHost->unlinkEvictedContentTexturesBackings(request->evictedContentsTexturesBackings);
+ m_layerTreeHost->contentsTextureManager()->unlinkEvictedBackings(request->evictedContentsTexturesBackings);
OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue);
m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes);
@@ -598,24 +597,17 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
return;
}
- // Clear any uploads we were making to textures linked to evicted
- // resources
- if (m_layerTreeHost->evictedContentsTexturesBackingsExist())
+ if (m_layerTreeHost->contentsTextureManager()->linkedEvictedBackingsExist()) {
+ // Clear any uploads we were making to textures linked to evicted
+ // resources
queue->clearUploadsToEvictedResources();
-
- // If we unlinked evicted textures on the main thread, delete them now.
- if (m_layerTreeHost->deleteEvictedContentTexturesBackings()) {
- // Deleting the evicted textures' backings resulted in some textures in the
- // layer tree being invalidated (unliked from their backings). Kick off
- // another commit to fill them again.
+ // Some textures in the layer tree are invalid. Kick off another commit
+ // to fill them again.
setNeedsCommitOnImplThread();
- } else {
- // The layer tree does not reference evicted textures, so mark that we
- // can draw this tree once this commit is complete.
- if (m_layerTreeHostImpl->contentsTexturesPurged())
- m_resetContentsTexturesPurgedAfterCommitOnImplThread = true;
}
+ m_layerTreeHost->contentsTextureManager()->pushTexturePrioritiesToBackings();
+
m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(this, CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->resourceProvider()->textureUploader());
m_currentTextureUpdateControllerOnImplThread->performMoreUpdates(
m_schedulerOnImplThread->anticipatedDrawTime());
@@ -644,14 +636,17 @@ void CCThreadProxy::scheduledActionCommit()
m_currentTextureUpdateControllerOnImplThread->finalize();
m_currentTextureUpdateControllerOnImplThread.clear();
- m_layerTreeHostImpl->beginCommit();
+ // If there are linked evicted backings, these backings' resources may be put into the
+ // impl tree, so we can't draw yet. Determine this before clearing all evicted backings.
+ bool newImplTreeHasNoEvictedResources = !m_layerTreeHost->contentsTextureManager()->linkedEvictedBackingsExist();
+ m_layerTreeHostImpl->beginCommit();
m_layerTreeHost->beginCommitOnImplThread(m_layerTreeHostImpl.get());
m_layerTreeHost->finishCommitOnImplThread(m_layerTreeHostImpl.get());
- if (m_resetContentsTexturesPurgedAfterCommitOnImplThread) {
- m_resetContentsTexturesPurgedAfterCommitOnImplThread = false;
- m_layerTreeHostImpl->resetContentsTexturesPurged();
+ if (newImplTreeHasNoEvictedResources) {
+ if (m_layerTreeHostImpl->contentsTexturesPurged())
+ m_layerTreeHostImpl->resetContentsTexturesPurged();
}
m_layerTreeHostImpl->commitComplete();
« no previous file with comments | « cc/thread_proxy.h ('k') | cc/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698