| Index: cc/thread_proxy.cc
|
| diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
|
| index b7e0e7c405e9c5518d600b6b875f37ab72fbabca..dd6f38fa99418b63a46c1f603b2d92caa8217b85 100644
|
| --- a/cc/thread_proxy.cc
|
| +++ b/cc/thread_proxy.cc
|
| @@ -50,6 +50,7 @@ ThreadProxy::ThreadProxy(LayerTreeHost* layerTreeHost, scoped_ptr<Thread> implTh
|
| , m_readbackRequestOnImplThread(0)
|
| , m_commitCompletionEventOnImplThread(0)
|
| , m_textureAcquisitionCompletionEventOnImplThread(0)
|
| + , m_pendingTreeActivationEventOnImplThread(0)
|
| , m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
|
| , m_renderVSyncEnabled(layerTreeHost->settings().renderVSyncEnabled)
|
| , m_totalCommitCount(0)
|
| @@ -643,6 +644,9 @@ void ThreadProxy::beginFrame(scoped_ptr<BeginFrameAndCommitState> beginFrameStat
|
|
|
| m_layerTreeHost->commitComplete();
|
| m_layerTreeHost->didBeginFrame();
|
| +
|
| + if (m_layerTreeHost->settings().implSidePainting)
|
| + blockUntilPendingActivationIfNeeded();
|
| }
|
|
|
| void ThreadProxy::beginFrameCompleteOnImplThread(CompletionEvent* completion, ResourceUpdateQueue* rawQueue)
|
| @@ -770,6 +774,14 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
|
| }
|
| m_layerTreeHostImpl->didDrawAllLayers(frame);
|
|
|
| + // Check for tree activation
|
| + if (m_pendingTreeActivationEventOnImplThread && !m_layerTreeHostImpl->pendingTree())
|
| + {
|
| + DCHECK(m_layerTreeHostImpl->settings().implSidePainting);
|
| + m_pendingTreeActivationEventOnImplThread->signal();
|
| + m_pendingTreeActivationEventOnImplThread = 0;
|
| + }
|
| +
|
| // Check for a pending compositeAndReadback.
|
| if (m_readbackRequestOnImplThread) {
|
| m_readbackRequestOnImplThread->success = false;
|
| @@ -1012,4 +1024,34 @@ void ThreadProxy::commitPendingOnImplThreadForTesting(CommitPendingRequest* requ
|
| request->completion.signal();
|
| }
|
|
|
| +void ThreadProxy::blockUntilPendingActivationIfNeeded()
|
| +{
|
| + DCHECK(isMainThread());
|
| + DCHECK(m_layerTreeHost->settings().implSidePainting);
|
| +
|
| + if (!m_layerTreeHost->blocksPendingCommit())
|
| + return;
|
| +
|
| + TRACE_EVENT0("cc", "ThreadProxy::blockUntilPendingActivationIfNeeded");
|
| + DebugScopedSetMainThreadBlocked mainThreadBlocked(this);
|
| + CompletionEvent completion;
|
| + Proxy::implThread()->postTask(base::Bind(&ThreadProxy::blockUntilPendingActivationOnImplThread, m_implThreadWeakPtr, &completion));
|
| + completion.wait();
|
| +}
|
| +
|
| +void ThreadProxy::blockUntilPendingActivationOnImplThread(CompletionEvent* completion)
|
| +{
|
| + DCHECK(isImplThread());
|
| + DCHECK(isMainThreadBlocked());
|
| + DCHECK(m_layerTreeHostImpl->settings().implSidePainting);
|
| + CHECK(!m_pendingTreeActivationEventOnImplThread);
|
| +
|
| + if (!m_layerTreeHostImpl->pendingTree()) {
|
| + completion->signal();
|
| + return;
|
| + }
|
| +
|
| + m_pendingTreeActivationEventOnImplThread = completion;
|
| +}
|
| +
|
| } // namespace cc
|
|
|