WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
New hotness
bug-67417-20110915115125.patch (text/plain), 24.99 KB, created by
Nat Duca
on 2011-09-15 11:51:26 PDT
(
hide
)
Description:
New hotness
Filename:
MIME Type:
Creator:
Nat Duca
Created:
2011-09-15 11:51:26 PDT
Size:
24.99 KB
patch
obsolete
>Subversion Revision: 95123 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index b439da7580054c15c3a1b98624fd62f707780945..4150fbcafb0e27483553a900a42cf95b59976cd7 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,38 @@ >+2011-09-02 Nat Duca <nduca@chromium.org> >+ >+ [chromium] Make CCThreadProxy draw >+ https://bugs.webkit.org/show_bug.cgi?id=67417 >+ >+ Update the CCThreadProxy to correctly implement the CCProxy >+ interface, do all the right committing and updating steps, and >+ draw a picture on the screen. >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * platform/graphics/chromium/LayerRendererChromium.cpp: >+ (WebCore::LayerRendererChromium::LayerRendererChromium): >+ * platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp: >+ (WebCore::CCHeadsUpDisplay::enabled): >+ * platform/graphics/chromium/cc/CCThreadProxy.cpp: >+ (WebCore::CCThreadProxy::CCThreadProxy): >+ (WebCore::CCThreadProxy::~CCThreadProxy): >+ (WebCore::CCThreadProxy::compositeAndReadback): >+ (WebCore::CCThreadProxy::finishAllRendering): >+ (WebCore::CCThreadProxy::isStarted): >+ (WebCore::CCThreadProxy::setNeedsCommitAndRedraw): >+ (WebCore::CCThreadProxy::setNeedsRedraw): >+ (WebCore::CCThreadProxy::start): >+ (WebCore::CCThreadProxy::stop): >+ (WebCore::CCThreadProxy::finishAllRenderingOnCCThread): >+ (WebCore::CCThreadProxy::beginFrameAndCommitOnCCThread): >+ (WebCore::CCThreadProxy::beginFrame): >+ (WebCore::CCThreadProxy::beginFrameAndCommit): >+ (WebCore::CCThreadProxy::commitAndDrawOnCCThread): >+ (WebCore::CCThreadProxy::commitAndDrawAndReadbackOnCCThread): >+ (WebCore::CCThreadProxy::drawLayersOnCCThread): >+ (WebCore::CCThreadProxy::setNeedsCommitAndRedrawOnCCThread): >+ * platform/graphics/chromium/cc/CCThreadProxy.h: >+ > 2011-09-14 David Hyatt <hyatt@apple.com> > > https://bugs.webkit.org/show_bug.cgi?id=68103 >diff --git a/Source/WebCore/platform/graphics/IntRect.h b/Source/WebCore/platform/graphics/IntRect.h >index 670ea3c1889e805d15758b5dd92e7e940c07081d..24f84bed4f75f5a676a054c51a058ab726500f2f 100644 >--- a/Source/WebCore/platform/graphics/IntRect.h >+++ b/Source/WebCore/platform/graphics/IntRect.h >@@ -26,6 +26,7 @@ > #ifndef IntRect_h > #define IntRect_h > >+#include "CrossThreadCopier.h" > #include "IntPoint.h" > #include <wtf/Vector.h> > >@@ -257,6 +258,10 @@ IntRect enclosingIntRect(const CGRect&); > IntRect enclosingIntRect(const NSRect&); > #endif > >+// Allow IntRects to move across thread boundaries. >+template<> struct CrossThreadCopierBase<false, false, IntRect> : public CrossThreadCopierPassThrough<IntRect> { >+}; >+ > } // namespace WebCore > > #endif // IntRect_h >diff --git a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >index c72816975d2244876e181cb907407b9eea15ab1f..6203b5b164adf90d88f197211d03ba6b2edb765d 100644 >--- a/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >+++ b/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp >@@ -181,6 +181,7 @@ bool LayerRendererChromium::initialize() > > LayerRendererChromium::~LayerRendererChromium() > { >+ ASSERT(CCProxy::isMainThread()); > m_headsUpDisplay.clear(); // Explicitly destroy the HUD before the TextureManager dies. > cleanupSharedObjects(); > } >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >index 8c0863010c2518bde9712782cca9ec63cbaf1fd0..27f0cb9c3c10491cec1504f63914a05707a41472 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCHeadsUpDisplay.cpp >@@ -89,6 +89,9 @@ void CCHeadsUpDisplay::onPresent() > > bool CCHeadsUpDisplay::enabled() const > { >+ // FIXME: HUD does not work in compositor thread mode. >+ if (settings().enableCompositorThread) >+ return false; > return settings().showPlatformLayerTree || settings().showFPSCounter; > } > >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >index b02f1ef31644ace995ccd6ec59db0ba4b020e83a..2bb4901ba04e6eefa895c65aba1c393bdd96c7fc 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.cpp >@@ -79,10 +79,12 @@ CCLayerImpl::CCLayerImpl(int id) > , m_debugBorderWidth(0) > , m_layerRenderer(0) > { >+ ASSERT(CCProxy::isImplThread()); > } > > CCLayerImpl::~CCLayerImpl() > { >+ ASSERT(CCProxy::isImplThread()); > } > > void CCLayerImpl::addChild(PassRefPtr<CCLayerImpl> child) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >index cea579c936973c1ebba82ff88dc0814dd9dcadb0..98b61bc1c09fa7cc439b8b4f29f3fd460bbb6d3e 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp >@@ -57,6 +57,7 @@ CCLayerTreeHost::CCLayerTreeHost(CCLayerTreeHostClient* client, const CCSettings > , m_zoomAnimatorScale(1) > , m_visible(true) > { >+ ASSERT(CCProxy::isMainThread()); > } > > bool CCLayerTreeHost::initialize() >@@ -115,6 +116,11 @@ void CCLayerTreeHost::animateAndLayout(double frameBeginTime) > m_animating = false; > } > >+// This function commits the CCLayerTreeHost to an impl tree. When modifying >+// this function, keep in mind that the function *runs* on the impl thread! Any >+// code that is logically a main thread operation, e.g. deletion of a LayerChromium, >+// should be delayed until the CCLayerTreeHost::commitComplete, which will run >+// after the commit, but on the main thread. > void CCLayerTreeHost::commitTo(CCLayerTreeHostImpl* hostImpl) > { > ASSERT(CCProxy::isImplThread()); >@@ -125,14 +131,12 @@ void CCLayerTreeHost::commitTo(CCLayerTreeHostImpl* hostImpl) > contentsTextureManager()->deleteEvictedTextures(hostImpl->context()); > > updateCompositorResources(m_updateList, hostImpl->context()); >- m_updateList.clear(); > > hostImpl->setVisible(m_visible); > hostImpl->setZoomAnimatorScale(m_zoomAnimatorScale); > hostImpl->setViewport(viewportSize()); > > hostImpl->layerRenderer()->setContentsTextureMemoryUseBytes(m_contentsTextureManager->currentMemoryUseBytes()); >- m_contentsTextureManager->unprotectAllTextures(); > > // Synchronize trees, if one exists at all... > if (rootLayer()) >@@ -143,6 +147,12 @@ void CCLayerTreeHost::commitTo(CCLayerTreeHostImpl* hostImpl) > m_frameNumber++; > } > >+void CCLayerTreeHost::commitComplete() >+{ >+ m_updateList.clear(); >+ m_contentsTextureManager->unprotectAllTextures(); >+} >+ > PassOwnPtr<CCThread> CCLayerTreeHost::createCompositorThread() > { > return m_client->createCompositorThread(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >index c713f03e7ad23179ac877630a23c9f4781b71c57..17329c38220093d7239a6ccc1a4b841e4ece1e0b 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h >@@ -99,6 +99,7 @@ public: > > // CCLayerTreeHost interface to CCProxy. > void animateAndLayout(double frameBeginTime); >+ void commitComplete(); > void commitTo(CCLayerTreeHostImpl*); > PassOwnPtr<CCThread> createCompositorThread(); > PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >index bec7c02d25ee513a9285675cc74b90544193592b..c75eb98e2d1c869f5f7da65d91a17c540613a4a9 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp >@@ -48,10 +48,12 @@ CCLayerTreeHostImpl::CCLayerTreeHostImpl(const CCSettings& settings) > , m_frameNumber(0) > , m_settings(settings) > { >+ ASSERT(CCProxy::isImplThread()); > } > > CCLayerTreeHostImpl::~CCLayerTreeHostImpl() > { >+ ASSERT(CCProxy::isImplThread()); > TRACE_EVENT("CCLayerTreeHostImpl::~CCLayerTreeHostImpl()", this, 0); > if (m_layerRenderer) > m_layerRenderer->close(); >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >index 2d27d729b3821139f0817cedb47eaeefaf385887..002a4ab76501f5710253febb955781a0a5a6cba4 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp >@@ -111,8 +111,15 @@ GraphicsContext3D* CCSingleThreadProxy::context() > void CCSingleThreadProxy::finishAllRendering() > { > ASSERT(isMainThread()); >- ScopedSetImplThread impl; >- m_layerTreeHostImpl->finishAllRendering(); >+ if (!recreateContextIfNeeded()) >+ return; >+ >+ commitIfNeeded(); >+ >+ { >+ ScopedSetImplThread impl; >+ m_layerTreeHostImpl->finishAllRendering(); >+ } > } > > bool CCSingleThreadProxy::isStarted() const >@@ -157,6 +164,7 @@ void CCSingleThreadProxy::setNeedsCommit() > m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); > m_layerTreeHostImpl->commitComplete(); > } >+ m_layerTreeHost->commitComplete(); > } > > void CCSingleThreadProxy::setNeedsCommitAndRedraw() >@@ -250,6 +258,7 @@ void CCSingleThreadProxy::commitIfNeeded() > m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); > m_layerTreeHostImpl->commitComplete(); > } >+ m_layerTreeHost->commitComplete(); > } > > bool CCSingleThreadProxy::doComposite() >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >index 12b5b361a7b5c26e0d006b773f00867095c87367..047b4dfd38d626a47836ea244965e637837e56ed 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp >@@ -31,6 +31,7 @@ > #include "cc/CCLayerTreeHost.h" > #include "cc/CCMainThreadTask.h" > #include "cc/CCThreadTask.h" >+#include <wtf/CurrentTime.h> > #include <wtf/MainThread.h> > > using namespace WTF; >@@ -48,8 +49,9 @@ PassOwnPtr<CCProxy> CCThreadProxy::create(CCLayerTreeHost* layerTreeHost) > } > > CCThreadProxy::CCThreadProxy(CCLayerTreeHost* layerTreeHost) >- : m_commitPending(false) >+ : m_commitRequested(false) > , m_layerTreeHost(layerTreeHost) >+ , m_started(false) > { > TRACE_EVENT("CCThreadProxy::CCThreadProxy", this, 0); > ASSERT(isMainThread()); >@@ -66,8 +68,7 @@ CCThreadProxy::~CCThreadProxy() > { > TRACE_EVENT("CCThreadProxy::~CCThreadProxy", this, 0); > ASSERT(isMainThread()); >- ASSERT(!m_layerTreeHostImpl); // Make sure stop() got called. >- ASSERT(!m_layerTreeHost); // Make sure stop() got called. >+ ASSERT(!m_started); > > numProxies--; > if (!numProxies) { >@@ -78,8 +79,28 @@ CCThreadProxy::~CCThreadProxy() > > bool CCThreadProxy::compositeAndReadback(void *pixels, const IntRect& rect) > { >- ASSERT_NOT_REACHED(); >- return false; >+ ASSERT(m_layerTreeHost); >+ >+ finishAllRendering(); >+ bool success; >+ CCCompletionEvent completion; >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndReadbackOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&success), AllowCrossThreadAccess(pixels), rect)); >+ completion.wait(); >+ return success; >+} >+ >+void CCThreadProxy::drawLayersAndReadbackOnCCThread(CCCompletionEvent* completion, bool* success, void* pixels, const IntRect& rect) >+{ >+ ASSERT(CCProxy::isImplThread()); >+ if (!m_layerTreeHostImpl) { >+ *success = false; >+ completion->signal(); >+ return; >+ } >+ drawLayersOnCCThread(); >+ m_layerTreeHostImpl->readback(pixels, rect); >+ *success = m_layerTreeHostImpl->isContextLost(); >+ completion->signal(); > } > > GraphicsContext3D* CCThreadProxy::context() >@@ -90,12 +111,34 @@ GraphicsContext3D* CCThreadProxy::context() > > void CCThreadProxy::finishAllRendering() > { >- ASSERT_NOT_REACHED(); >+ ASSERT(CCProxy::isMainThread()); >+ // If a commit is pending, perform the commit first. >+ if (m_commitRequested) { >+ // This bit of code is uglier than it should be because returning >+ // pointers via the CCThread task model is really messy. Effectively, we >+ // are making a blocking call to createBeginFrameAndCommitTaskOnCCThread, >+ // and trying to get the CCMainThread::Task it returns so we can run it. >+ OwnPtr<CCMainThread::Task> beginFrameAndCommitTask; >+ { >+ CCMainThread::Task* taskPtr; >+ CCCompletionEvent completion; >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread, AllowCrossThreadAccess(&completion), AllowCrossThreadAccess(&taskPtr))); >+ completion.wait(); >+ beginFrameAndCommitTask = adoptPtr(taskPtr); >+ } >+ >+ beginFrameAndCommitTask->performTask(); >+ } >+ // Make sure all GL drawing is finished on the impl thread. >+ CCCompletionEvent completion; >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::finishAllRenderingOnCCThread, AllowCrossThreadAccess(&completion))); >+ completion.wait(); > } > > bool CCThreadProxy::isStarted() const > { >- return m_layerTreeHostImpl; >+ ASSERT(CCProxy::isMainThread()); >+ return m_started; > } > > bool CCThreadProxy::initializeLayerRenderer() >@@ -136,29 +179,38 @@ void CCThreadProxy::loseCompositorContext(int numTimes) > void CCThreadProxy::setNeedsCommit() > { > ASSERT(isMainThread()); >- if (m_commitPending) >+ if (m_commitRequested) > return; > > TRACE_EVENT("CCThreadProxy::setNeedsCommit", this, 0); >- m_commitPending = true; >- ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitOnCCThread)); >+ m_commitRequested = true; >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true)); > } > > void CCThreadProxy::setNeedsCommitAndRedraw() > { > ASSERT(isMainThread()); >- if (m_commitPending) >+ if (m_commitRequested) > return; >+ m_commitRequested = true; > > TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedraw", this, 0); >- m_commitPending = true; >- ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsCommitAndRedrawOnCCThread)); >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, m_commitRequested, true)); > } > > void CCThreadProxy::setNeedsRedraw() > { > ASSERT(isMainThread()); >- ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::setNeedsRedrawOnCCThread)); >+ if (m_commitRequested) // Implies that a commit is in flight. >+ return; >+ // Unlike setNeedsCommit that tracks whether a commit message has been sent, >+ // setNeedsRedraw always sends a message to the compositor thread. This is >+ // because the compositor thread can draw without telling the main >+ // thread. This should not be much of a problem because calls to >+ // setNeedsRedraw messages are uncommon (only triggered by WM_PAINT/etc), >+ // compared to setNeedsCommitAndRedraw messages. >+ TRACE_EVENT("CCThreadProxy::setNeedsRedraw", this, 0); >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::updateSchedulerStateOnCCThread, false, true)); > } > > void CCThreadProxy::start() >@@ -167,12 +219,16 @@ void CCThreadProxy::start() > CCCompletionEvent completion; > ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::initializeImplOnCCThread, AllowCrossThreadAccess(&completion))); > completion.wait(); >+ >+ m_started = true; > } > > void CCThreadProxy::stop() > { > TRACE_EVENT("CCThreadProxy::stop", this, 0); > ASSERT(isMainThread()); >+ if (!m_started) >+ return; > // Synchronously deletes the impl. > CCCompletionEvent completion; > ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::layerTreeHostClosedOnCCThread, AllowCrossThreadAccess(&completion))); >@@ -180,80 +236,129 @@ void CCThreadProxy::stop() > > ASSERT(!m_layerTreeHostImpl); // verify that the impl deleted. > m_layerTreeHost = 0; >+ m_started = false; >+} >+ >+void CCThreadProxy::finishAllRenderingOnCCThread(CCCompletionEvent* completion) >+{ >+ ASSERT(isImplThread()); >+ ASSERT(!m_beginFrameAndCommitPendingOnCCThread); >+ if (m_redrawRequestedOnCCThread) { >+ drawLayersOnCCThread(); >+ m_layerTreeHostImpl->present(); >+ m_redrawRequestedOnCCThread = false; >+ } >+ m_layerTreeHostImpl->finishAllRendering(); >+ completion->signal(); > } > >-void CCThreadProxy::beginFrameAndCommitOnCCThread() >+void CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread(CCCompletionEvent* completion, CCMainThread::Task** taskPtr) >+{ >+ OwnPtr<CCMainThread::Task> task = createBeginFrameAndCommitTaskOnCCThread(); >+ *taskPtr = task.leakPtr(); >+ completion->signal(); >+} >+ >+PassOwnPtr<CCMainThread::Task> CCThreadProxy::createBeginFrameAndCommitTaskOnCCThread() > { > TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0); > ASSERT(isImplThread()); >- ASSERT_NOT_REACHED(); >- // FIXME: call beginFrameAndCommit on main thread >+ ASSERT(!m_beginFrameAndCommitPendingOnCCThread); >+ double frameBeginTime = currentTime(); >+ m_beginFrameAndCommitPendingOnCCThread = true; >+ return createMainThreadTask(this, &CCThreadProxy::beginFrameAndCommit, frameBeginTime); > } > > void CCThreadProxy::beginFrameAndCommit(double frameBeginTime) > { >+ TRACE_EVENT("CCThreadProxy::beginFrameAndCommit", this, 0); > ASSERT(isMainThread()); > if (!m_layerTreeHost) > return; > >- TRACE_EVENT("CCThreadProxy::requestFrameAndCommit", this, 0); >+ ASSERT(m_commitRequested); >+ >+ // FIXME: recreate the context if it was requested by the impl thread > { > TRACE_EVENT("CCLayerTreeHost::animateAndLayout", this, 0); > m_layerTreeHost->animateAndLayout(frameBeginTime); > } > >- m_commitPending = false; >+ // Clear the commit flag after animateAndLayout here --- objects that only >+ // layout when painted will trigger another setNeedsCommit inside >+ // updateLayers. >+ m_commitRequested = false; > >- // Blocking call to CCThreadProxy::performCommit >- CCCompletionEvent completion; >- ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion))); >- completion.wait(); >+ m_layerTreeHost->updateLayers(); >+ >+ { >+ // Blocking call to CCThreadProxy::commitOnCCThread >+ TRACE_EVENT("commit", this, 0); >+ CCCompletionEvent completion; >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::commitOnCCThread, AllowCrossThreadAccess(&completion))); >+ completion.wait(); >+ } >+ >+ m_layerTreeHost->commitComplete(); > } > > void CCThreadProxy::commitOnCCThread(CCCompletionEvent* completion) > { >+ TRACE_EVENT("CCThreadProxy::beginFrameAndCommitOnCCThread", this, 0); > ASSERT(isImplThread()); >- TRACE_EVENT("CCThreadProxy::commitOnCCThread", this, 0); >- m_layerTreeHostImpl->beginCommit(); >- { >- TRACE_EVENT("CCLayerTreeHost::commit", this, 0); >- m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); >+ ASSERT(m_beginFrameAndCommitPendingOnCCThread); >+ m_beginFrameAndCommitPendingOnCCThread = false; >+ if (!m_layerTreeHostImpl) { >+ completion->signal(); >+ return; > } >+ m_layerTreeHostImpl->beginCommit(); >+ m_layerTreeHost->commitTo(m_layerTreeHostImpl.get()); >+ m_layerTreeHostImpl->commitComplete(); >+ > completion->signal(); > >- m_layerTreeHostImpl->commitComplete(); >- setNeedsRedrawOnCCThread(); >+ if (m_redrawRequestedOnCCThread) { >+ ccThread->postTask(createCCThreadTask(this, &CCThreadProxy::drawLayersAndPresentOnCCThread)); >+ m_redrawRequestedOnCCThread = false; >+ } > } > >-void CCThreadProxy::drawLayersOnCCThread() >+void CCThreadProxy::drawLayersAndPresentOnCCThread() > { > TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0); > ASSERT(isImplThread()); >- if (m_layerTreeHostImpl) >- m_layerTreeHostImpl->drawLayers(); >+ if (!m_layerTreeHostImpl) >+ return; >+ drawLayersOnCCThread(); >+ m_layerTreeHostImpl->present(); > } > >-void CCThreadProxy::setNeedsCommitOnCCThread() >+void CCThreadProxy::drawLayersOnCCThread() > { >- TRACE_EVENT("CCThreadProxy::setNeedsCommitOnCCThread", this, 0); >+ TRACE_EVENT("CCThreadProxy::drawLayersOnCCThread", this, 0); > ASSERT(isImplThread()); > ASSERT(m_layerTreeHostImpl); >- // FIXME: Not yet implemented, see https://bugs.webkit.org/show_bug.cgi?id=67417 >- ASSERT_NOT_REACHED(); >+ >+ m_layerTreeHostImpl->drawLayers(); >+ ASSERT(!m_layerTreeHostImpl->isContextLost()); > } > >-void CCThreadProxy::setNeedsCommitAndRedrawOnCCThread() >+void CCThreadProxy::updateSchedulerStateOnCCThread(bool commitRequested, bool redrawRequested) > { >- TRACE_EVENT("CCThreadProxy::setNeedsCommitAndRedrawOnCCThread", this, 0); >+ TRACE_EVENT("CCThreadProxy::setNeedsCommitOnCCThread", this, 0); > ASSERT(isImplThread()); > ASSERT(m_layerTreeHostImpl); >- ASSERT_NOT_REACHED(); >-} > >-void CCThreadProxy::setNeedsRedrawOnCCThread() >-{ >- TRACE_EVENT("CCThreadProxy::setNeedsRedrawOnCCThread", this, 0); >- ASSERT_NOT_REACHED(); >+ // FIXME: use CCScheduler to decide when to manage the conversion of this >+ // commit request into an actual createBeginFrameAndCommitTaskOnCCThread call. >+ m_redrawRequestedOnCCThread |= redrawRequested; >+ if (!m_beginFrameAndCommitPendingOnCCThread) { >+ CCMainThread::postTask(createBeginFrameAndCommitTaskOnCCThread()); >+ return; >+ } >+ if (!commitRequested) >+ drawLayersOnCCThread(); > } > > void CCThreadProxy::initializeImplOnCCThread(CCCompletionEvent* completion) >diff --git a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >index 24677240caaa6912676d7edfe0fab2cc21262ec2..adc8bb5eae86e0ce811ea672c9a786d1f26e60ad 100644 >--- a/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >+++ b/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h >@@ -27,6 +27,7 @@ > > #include "cc/CCCompletionEvent.h" > #include "cc/CCLayerTreeHostImpl.h" >+#include "cc/CCMainThread.h" > #include "cc/CCProxy.h" > #include <wtf/OwnPtr.h> > >@@ -61,25 +62,29 @@ private: > void beginFrameAndCommit(double frameBeginTime); > > // Called on CCThread >- void beginFrameAndCommitOnCCThread(); >+ PassOwnPtr<CCMainThread::Task> createBeginFrameAndCommitTaskOnCCThread(); >+ void createBeginFrameAndCommitTaskOnCCThread(CCCompletionEvent*, CCMainThread::Task**); > void commitOnCCThread(CCCompletionEvent*); >+ void drawLayersAndPresentOnCCThread(); > void drawLayersOnCCThread(); >+ void drawLayersAndReadbackOnCCThread(CCCompletionEvent*, bool* success, void* pixels, const IntRect&); >+ void finishAllRenderingOnCCThread(CCCompletionEvent*); > void initializeImplOnCCThread(CCCompletionEvent*); > void initializeLayerRendererOnCCThread(GraphicsContext3D*, CCCompletionEvent*, bool* initializeSucceeded, LayerRendererCapabilities*); > void setNeedsCommitOnCCThread(); >- void setNeedsCommitAndRedrawOnCCThread(); >- void setNeedsRedrawOnCCThread(); >+ void updateSchedulerStateOnCCThread(bool commitRequested, bool redrawRequested); > void layerTreeHostClosedOnCCThread(CCCompletionEvent*); > >- // Used on main-thread only. >- bool m_commitPending; >- > // Accessed on main thread only. >+ bool m_commitRequested; > CCLayerTreeHost* m_layerTreeHost; > LayerRendererCapabilities m_layerRendererCapabilitiesMainThreadCopy; >+ bool m_started; > >- // Used on the CCThread, but checked on main thread during initialization/shutdown. >+ // Used on the CCThread only > OwnPtr<CCLayerTreeHostImpl> m_layerTreeHostImpl; >+ bool m_beginFrameAndCommitPendingOnCCThread; >+ bool m_redrawRequestedOnCCThread; > }; > > } >diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog >index dc8b1f337cedb1944aa36bf06990b3e7f601d857..0c6a822b99fdd5dc1ed0623ea036eb1f67074330 100644 >--- a/Source/WebKit/chromium/ChangeLog >+++ b/Source/WebKit/chromium/ChangeLog >@@ -1,3 +1,13 @@ >+2011-09-02 Nat Duca <nduca@chromium.org> >+ >+ [chromium] Make CCThreadProxy draw >+ https://bugs.webkit.org/show_bug.cgi?id=67417 >+ >+ Disable CCLayerTreeHostTest completely as it does not >+ compile when the threaded switch is enabled. >+ >+ * tests/CCLayerTreeHostTest.cpp: >+ > 2011-09-14 Anders Carlsson <andersca@apple.com> > > Fix Chromium build. >diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >index d854806584ff33ea135c6d09b552f709ed016710..fd076ee57139564d71a31efe157201d5af747df1 100644 >--- a/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >+++ b/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp >@@ -24,7 +24,8 @@ > > #include "config.h" > >-#if USE(THREADED_COMPOSITING) >+// CCLayerTreeHost disabled. See b67418. >+#if 0 > > #include "cc/CCLayerTreeHost.h" >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 67417
:
106102
|
107441
|
107523
|
107578
|
107586
|
107727
|
108389
|
108556
|
108559