Index: cc/CCThreadProxy.cpp |
diff --git a/cc/CCThreadProxy.cpp b/cc/CCThreadProxy.cpp |
index 26e734b8565f09e63fa789d162a0a7a20bb3cbdd..cf8a4b25a2d4f6b2da88c2aa95d427958f46e4b4 100644 |
--- a/cc/CCThreadProxy.cpp |
+++ b/cc/CCThreadProxy.cpp |
@@ -61,7 +61,10 @@ CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) |
, m_textureAcquisitionCompletionEventOnImplThread(0) |
, m_resetContentsTexturesPurgedAfterCommitOnImplThread(false) |
, m_nextFrameIsNewlyCommittedFrameOnImplThread(false) |
+ , m_mostRecentMaxTextureUpdatesOnMainThread(CCTextureUpdateController::maxTextureUpdatesDefault()) |
, m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled) |
+ , m_totalCommitTime(0) |
+ , m_totalCommitCount(0) |
{ |
TRACE_EVENT0("cc", "CCThreadProxy::CCThreadProxy"); |
ASSERT(isMainThread()); |
@@ -85,7 +88,6 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) |
return false; |
} |
- |
// Perform a synchronous commit. |
{ |
DebugScopedSetMainThreadBlocked mainThreadBlocked; |
@@ -94,7 +96,7 @@ bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) |
beginFrameCompletion.wait(); |
} |
m_inCompositeAndReadback = true; |
- beginFrame(); |
+ beginFrame(m_mostRecentMaxTextureUpdatesOnMainThread); |
m_inCompositeAndReadback = false; |
// Perform a synchronous readback. |
@@ -249,15 +251,18 @@ bool CCThreadProxy::recreateContext() |
return recreateSucceeded; |
} |
-void CCThreadProxy::implSideRenderingStats(CCRenderingStats& stats) |
+void CCThreadProxy::renderingStats(CCRenderingStats& stats) |
{ |
ASSERT(isMainThread()); |
DebugScopedSetMainThreadBlocked mainThreadBlocked; |
CCCompletionEvent completion; |
- CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::implSideRenderingStatsOnImplThread, |
+ CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::renderingStatsOnImplThread, |
&completion, |
&stats)); |
+ stats.totalCommitTimeInSeconds = m_totalCommitTime; |
+ stats.totalCommitCount = m_totalCommitCount; |
+ |
completion.wait(); |
} |
@@ -458,7 +463,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 maxTextureUpdates = CCTextureUpdateController::maxTextureUpdatesDefault(); |
+ if (m_layerTreeHostImpl && m_layerTreeHostImpl->renderer() && m_layerTreeHostImpl->renderer()->textureUploader()) |
+ maxTextureUpdates = CCTextureUpdateController::maxTextureUpdates(m_layerTreeHostImpl->renderer()->textureUploader()); |
+ |
+ m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame, maxTextureUpdates)); |
if (m_beginFrameCompletionEventOnImplThread) { |
m_beginFrameCompletionEventOnImplThread->signal(); |
@@ -466,10 +475,13 @@ void CCThreadProxy::scheduledActionBeginFrame() |
} |
} |
-void CCThreadProxy::beginFrame() |
+void CCThreadProxy::beginFrame(size_t maxTextureUpdates) |
{ |
TRACE_EVENT0("cc", "CCThreadProxy::beginFrame"); |
ASSERT(isMainThread()); |
+ |
+ m_mostRecentMaxTextureUpdatesOnMainThread = maxTextureUpdates; |
+ |
if (!m_layerTreeHost) |
return; |
@@ -531,7 +543,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, maxTextureUpdates); |
// Once single buffered layers are committed, they cannot be modified until |
// they are drawn by the impl thread. |
@@ -555,18 +567,25 @@ void CCThreadProxy::beginFrame() |
// coordinated by the CCScheduler. |
{ |
TRACE_EVENT0("cc", "commit"); |
+ |
DebugScopedSetMainThreadBlocked mainThreadBlocked; |
+ double startTime = WTF::monotonicallyIncreasingTime(); |
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, maxTextureUpdates)); |
completion.wait(); |
+ double endTime = WTF::monotonicallyIncreasingTime(); |
+ |
+ double commitTime = endTime - startTime; |
+ m_totalCommitTime += commitTime; |
+ m_totalCommitCount++; |
} |
m_layerTreeHost->commitComplete(); |
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 maxTextureUpdates) |
{ |
TRACE_EVENT0("cc", "CCThreadProxy::beginFrameCompleteOnImplThread"); |
ASSERT(!m_commitCompletionEventOnImplThread); |
@@ -595,7 +614,7 @@ void CCThreadProxy::beginFrameCompleteOnImplThread(CCCompletionEvent* completion |
setNeedsCommitOnImplThread(); |
} |
- m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader()); |
+ m_currentTextureUpdateControllerOnImplThread = CCTextureUpdateController::create(CCProxy::implThread(), queue, m_layerTreeHostImpl->resourceProvider(), m_layerTreeHostImpl->renderer()->textureCopier(), m_layerTreeHostImpl->renderer()->textureUploader(), maxTextureUpdates); |
m_commitCompletionEventOnImplThread = completion; |
m_schedulerOnImplThread->beginFrameComplete(); |
@@ -895,11 +914,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"); |
@@ -914,7 +928,7 @@ void CCThreadProxy::recreateContextOnImplThread(CCCompletionEvent* completion, C |
completion->signal(); |
} |
-void CCThreadProxy::implSideRenderingStatsOnImplThread(CCCompletionEvent* completion, CCRenderingStats* stats) |
+void CCThreadProxy::renderingStatsOnImplThread(CCCompletionEvent* completion, CCRenderingStats* stats) |
{ |
ASSERT(isImplThread()); |
m_layerTreeHostImpl->renderingStats(*stats); |