| Index: Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp
|
| ===================================================================
|
| --- Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (revision 122257)
|
| +++ Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (working copy)
|
| @@ -79,6 +79,7 @@
|
| , m_layerRendererInitialized(false)
|
| , m_started(false)
|
| , m_texturesAcquired(true)
|
| + , m_inCompositeAndReadback(false)
|
| , m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread()))
|
| , m_beginFrameCompletionEventOnImplThread(0)
|
| , m_readbackRequestOnImplThread(0)
|
| @@ -113,7 +114,9 @@
|
| CCCompletionEvent beginFrameCompletion;
|
| CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::forceBeginFrameOnImplThread, AllowCrossThreadAccess(&beginFrameCompletion)));
|
| beginFrameCompletion.wait();
|
| + m_inCompositeAndReadback = true;
|
| beginFrame();
|
| + m_inCompositeAndReadback = false;
|
|
|
| // Perform a synchronous readback.
|
| ReadbackRequest request;
|
| @@ -202,6 +205,22 @@
|
| m_schedulerOnImplThread->setCanBeginFrame(true);
|
| }
|
|
|
| +void CCThreadProxy::setVisible(bool visible)
|
| +{
|
| + TRACE_EVENT0("cc", "CCThreadProxy::setVisible");
|
| + CCCompletionEvent completion;
|
| + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setVisibleOnImplThread, AllowCrossThreadAccess(&completion), visible));
|
| + completion.wait();
|
| +}
|
| +
|
| +void CCThreadProxy::setVisibleOnImplThread(CCCompletionEvent* completion, bool visible)
|
| +{
|
| + TRACE_EVENT0("cc", "CCThreadProxy::setVisibleOnImplThread");
|
| + m_layerTreeHostImpl->setVisible(visible);
|
| + m_schedulerOnImplThread->setVisible(visible);
|
| + completion->signal();
|
| +}
|
| +
|
| bool CCThreadProxy::initializeLayerRenderer()
|
| {
|
| TRACE_EVENT("CCThreadProxy::initializeLayerRenderer", this, 0);
|
| @@ -299,18 +318,6 @@
|
| CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnImplThread));
|
| }
|
|
|
| -void CCThreadProxy::setNeedsForcedCommit()
|
| -{
|
| - ASSERT(isMainThread());
|
| - if (m_forcedCommitRequested)
|
| - return;
|
| -
|
| - TRACE_EVENT("CCThreadProxy::setNeedsForcedCommit", this, 0);
|
| - m_commitRequested = true;
|
| - m_forcedCommitRequested = true;
|
| - CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsForcedCommitOnImplThread));
|
| -}
|
| -
|
| void CCThreadProxy::didLoseContextOnImplThread()
|
| {
|
| ASSERT(isImplThread());
|
| @@ -348,12 +355,6 @@
|
| m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setAnimationEvents, events, wallClockTime));
|
| }
|
|
|
| -void CCThreadProxy::postSetContentsMemoryAllocationLimitBytesToMainThreadOnImplThread(size_t bytes)
|
| -{
|
| - ASSERT(isImplThread());
|
| - m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::setContentsMemoryAllocationLimitBytes, bytes));
|
| -}
|
| -
|
| void CCThreadProxy::setNeedsRedraw()
|
| {
|
| ASSERT(isMainThread());
|
| @@ -455,6 +456,8 @@
|
| m_pendingBeginFrameRequest->scrollInfo = m_layerTreeHostImpl->processScrollDeltas();
|
| m_currentTextureUpdaterOnImplThread = adoptPtr(new CCTextureUpdater);
|
| m_pendingBeginFrameRequest->updater = m_currentTextureUpdaterOnImplThread.get();
|
| + m_pendingBeginFrameRequest->contentsTexturesWereDeleted = m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit();
|
| + m_pendingBeginFrameRequest->memoryAllocationLimitBytes = m_layerTreeHostImpl->memoryAllocationLimitBytes();
|
|
|
| m_mainThreadProxy->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrame));
|
|
|
| @@ -497,9 +500,17 @@
|
| // Re-do the commit flow so that we don't send the scrollInfo on the BFAC message.
|
| m_layerTreeHost->applyScrollAndScale(*request->scrollInfo);
|
|
|
| + if (!m_inCompositeAndReadback && !m_layerTreeHost->visible()) {
|
| + m_commitRequested = false;
|
| + m_forcedCommitRequested = false;
|
| +
|
| + TRACE_EVENT0("cc", "EarlyOut_NotVisible");
|
| + CCProxy::implThread()->postTask(createCCThreadTask(this, &CCThreadProxy::beginFrameAbortedOnImplThread));
|
| + return;
|
| + }
|
| +
|
| m_layerTreeHost->willBeginFrame();
|
|
|
| - // FIXME: recreate the context if it was requested by the impl thread.
|
| m_layerTreeHost->updateAnimations(request->monotonicFrameBeginTime);
|
| m_layerTreeHost->layout();
|
|
|
| @@ -512,8 +523,11 @@
|
| if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
|
| return;
|
|
|
| - m_layerTreeHost->updateLayers(*request->updater);
|
| + if (request->contentsTexturesWereDeleted)
|
| + m_layerTreeHost->evictAllContentTextures();
|
|
|
| + m_layerTreeHost->updateLayers(*request->updater, request->memoryAllocationLimitBytes);
|
| +
|
| // Once single buffered layers are committed, they cannot be modified until
|
| // they are drawn by the impl thread.
|
| m_texturesAcquired = false;
|
| @@ -560,6 +574,16 @@
|
| m_schedulerOnImplThread->beginFrameComplete();
|
| }
|
|
|
| +void CCThreadProxy::beginFrameAbortedOnImplThread()
|
| +{
|
| + TRACE_EVENT0("cc", "CCThreadProxy::beginFrameAbortedOnImplThread");
|
| + ASSERT(isImplThread());
|
| + ASSERT(m_schedulerOnImplThread);
|
| + ASSERT(m_schedulerOnImplThread->commitPending());
|
| +
|
| + m_schedulerOnImplThread->beginFrameAborted();
|
| +}
|
| +
|
| bool CCThreadProxy::hasMoreResourceUpdates() const
|
| {
|
| if (!m_currentTextureUpdaterOnImplThread)
|
| @@ -660,9 +684,7 @@
|
| }
|
| m_readbackRequestOnImplThread->completion.signal();
|
| m_readbackRequestOnImplThread = 0;
|
| - }
|
| -
|
| - if (drawFrame)
|
| + } else if (drawFrame)
|
| result.didSwap = m_layerTreeHostImpl->swapBuffers();
|
|
|
| // Tell the main thread that the the newly-commited frame was drawn.
|
| @@ -745,14 +767,6 @@
|
| m_layerTreeHost->setAnimationEvents(events, wallClockTime);
|
| }
|
|
|
| -void CCThreadProxy::setContentsMemoryAllocationLimitBytes(size_t bytes)
|
| -{
|
| - ASSERT(isMainThread());
|
| - if (!m_layerTreeHost)
|
| - return;
|
| - m_layerTreeHost->setContentsMemoryAllocationLimitBytes(bytes);
|
| -}
|
| -
|
| class CCThreadProxyContextRecreationTimer : public CCTimer, CCTimerClient {
|
| public:
|
| static PassOwnPtr<CCThreadProxyContextRecreationTimer> create(CCThreadProxy* proxy) { return adoptPtr(new CCThreadProxyContextRecreationTimer(proxy)); }
|
| @@ -835,7 +849,8 @@
|
| {
|
| TRACE_EVENT("CCThreadProxy::layerTreeHostClosedOnImplThread", this, 0);
|
| ASSERT(isImplThread());
|
| - m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
|
| + if (!m_layerTreeHostImpl->contentsTexturesWerePurgedSinceLastCommit())
|
| + m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
|
| m_inputHandlerOnImplThread.clear();
|
| m_layerTreeHostImpl.clear();
|
| m_schedulerOnImplThread.clear();
|
|
|