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

Unified Diff: cc/CCThreadProxy.cpp

Issue 10916292: Adaptively throttle texture uploads (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc_unittests passing again Created 8 years, 3 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
Index: cc/CCThreadProxy.cpp
diff --git a/cc/CCThreadProxy.cpp b/cc/CCThreadProxy.cpp
index cf425e9880d6495109ead2fdcd56d0ca3efb82ff..7f6ed692a6facef9ba0c41acd41d243f9a745597 100644
--- a/cc/CCThreadProxy.cpp
+++ b/cc/CCThreadProxy.cpp
@@ -84,7 +84,6 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
return false;
}
-
// Perform a synchronous commit.
{
DebugScopedSetMainThreadBlocked mainThreadBlocked;
@@ -93,7 +92,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect)
beginFrameCompletion.wait();
}
m_inCompositeAndReadback = true;
- beginFrame();
+ beginFrame(0);
m_inCompositeAndReadback = false;
// Perform a synchronous readback.
@@ -456,7 +455,11 @@ void CCThreadProxy::scheduledActionBeginFrame()
m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesPurged();
m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
- m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
+ size_t maxPartialTextureUpdates = CCTextureUpdateController::maxPartialUpdatesDefault();
+ if (m_layerTreeHostImpl && m_layerTreeHostImpl->renderer() && m_layerTreeHostImpl->renderer()->textureUploader())
+ maxPartialTextureUpdates = CCTextureUpdateController::maxPartialUpdates(m_layerTreeHostImpl->renderer()->textureUploader());
+
+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame, maxPartialTextureUpdates));
if (m_beginFrameCompletionEventOnImplThread) {
m_beginFrameCompletionEventOnImplThread->signal();
@@ -464,10 +467,11 @@ void CCThreadProxy::scheduledActionBeginFrame()
}
}
-void CCThreadProxy::beginFrame()
+void CCThreadProxy::beginFrame(size_t maxPartialTextureUpdates)
{
TRACE_EVENT0("cc", "CCThreadProxy::beginFrame");
ASSERT(isMainThread());
+
if (!m_layerTreeHost)
return;
@@ -529,7 +533,7 @@ void CCThreadProxy::beginFrame()
m_layerTreeHost->unlinkAllContentTextures();
OwnPtr<CCTextureUpdateQueue> queue = adoptPtr(new CCTextureUpdateQueue);
- m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes);
+ m_layerTreeHost->updateLayers(*(queue.get()), request->memoryAllocationLimitBytes, maxPartialTextureUpdates);
// Once single buffered layers are committed, they cannot be modified until
// they are drawn by the impl thread.
@@ -556,7 +560,7 @@ void CCThreadProxy::beginFrame()
DebugScopedSetMainThreadBlocked mainThreadBlocked;
CCCompletionEvent completion;
- CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release(), request->contentsTexturesWereDeleted));
+ CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameCompleteOnImplThread, &completion, queue.release(), request->contentsTexturesWereDeleted, maxPartialTextureUpdates));
completion.wait();
}
@@ -564,7 +568,7 @@ void CCThreadProxy::beginFrame()
m_layerTreeHost->didBeginFrame();
}
-void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted)
+void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion, PassOwnPtr<CCTextureUpdateQueue> queue, bool contentsTexturesWereDeleted, size_t maxPartialTextureUpdates)
{
TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread");
ASSERT(!m_commitCompletionEventOnImplThread);
@@ -594,7 +598,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion
}
bool hasResourceUpdates = !!queue->fullUploadSize();
- m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(this, CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader());
+ m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(this, CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), maxPartialTextureUpdates);
m_commitCompletionEventOnImplThread = completion;
m_schedulerOnImplThread->beginFrameComplete(hasResourceUpdates);
@@ -896,11 +900,6 @@ void CCThreadProxy::setFullRootLayerDamageOnImplThread()
m_layerTreeHostImpl->setFullRootLayerDamage();
}
-size_t CCThreadProxy::maxPartialTextureUpdates() const
-{
- return CCTextureUpdateController::maxPartialTextureUpdates();
-}
-
void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, CCGraphicsContext* contextPtr, bool* recreateSucceeded, RendererCapabilities* capabilities)
{
TRACE_EVENT0("cc", "CCThreadProxy::recreateContextOnImplThread");

Powered by Google App Engine
This is Rietveld 408576698