Modified: trunk/Source/WebCore/ChangeLog (117824 => 117825)
--- trunk/Source/WebCore/ChangeLog 2012-05-21 22:33:59 UTC (rev 117824)
+++ trunk/Source/WebCore/ChangeLog 2012-05-21 22:57:49 UTC (rev 117825)
@@ -1,3 +1,22 @@
+2012-05-21 Antoine Labour <[email protected]>
+
+ Don't force rendering in finishAllRendering
+ https://bugs.webkit.org/show_bug.cgi?id=86919
+
+ Reviewed by James Robinson.
+
+ After we acquire the texture layers on the main thread, we can't draw.
+ In particular if we destroyed the texture ids used previously by
+ TextureLayerChromium, drawing before a commit would cause a
+ bind-after-destroy.
+
+ Tested by CCLayerTreeHostTestFinishAllRendering.
+
+ * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+ (WebCore::CCThreadProxy::CCThreadProxy):
+ (WebCore::CCThreadProxy::finishAllRenderingOnImplThread):
+ (WebCore::CCThreadProxy::scheduledActionDrawAndSwapInternal):
+
2012-05-21 Joshua Bell <[email protected]>
IndexedDB: Store key paths in IDBKeyPath type instead of String
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (117824 => 117825)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-05-21 22:33:59 UTC (rev 117824)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp 2012-05-21 22:57:49 UTC (rev 117825)
@@ -81,7 +81,6 @@
, m_mainThreadProxy(CCScopedThreadProxy::create(CCProxy::mainThread()))
, m_beginFrameCompletionEventOnImplThread(0)
, m_readbackRequestOnImplThread(0)
- , m_finishAllRenderingCompletionEventOnImplThread(0)
, m_commitCompletionEventOnImplThread(0)
, m_textureAcquisitionCompletionEventOnImplThread(0)
, m_nextFrameIsNewlyCommittedFrameOnImplThread(false)
@@ -431,10 +430,8 @@
{
TRACE_EVENT("CCThreadProxy::finishAllRenderingOnImplThread", this, 0);
ASSERT(isImplThread());
- ASSERT(!m_finishAllRenderingCompletionEventOnImplThread);
- m_finishAllRenderingCompletionEventOnImplThread = completion;
-
- m_schedulerOnImplThread->setNeedsForcedRedraw();
+ m_layerTreeHostImpl->finishAllRendering();
+ completion->signal();
}
void CCThreadProxy::forceBeginFrameOnImplThread(CCCompletionEvent* completion)
@@ -665,13 +662,6 @@
if (drawFrame)
result.didSwap = m_layerTreeHostImpl->swapBuffers();
- // Process any finish request
- if (m_finishAllRenderingCompletionEventOnImplThread) {
- m_layerTreeHostImpl->finishAllRendering();
- m_finishAllRenderingCompletionEventOnImplThread->signal();
- m_finishAllRenderingCompletionEventOnImplThread = 0;
- }
-
// Tell the main thread that the the newly-commited frame was drawn.
if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
m_nextFrameIsNewlyCommittedFrameOnImplThread = false;
Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (117824 => 117825)
--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-05-21 22:33:59 UTC (rev 117824)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp 2012-05-21 22:57:49 UTC (rev 117825)
@@ -49,8 +49,10 @@
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <public/Platform.h>
+#include <wtf/Locker.h>
#include <wtf/MainThread.h>
#include <wtf/PassRefPtr.h>
+#include <wtf/ThreadingPrimitives.h>
#include <wtf/Vector.h>
using namespace WebCore;
@@ -80,6 +82,7 @@
virtual void layout() { }
virtual void didRecreateContext(bool succeded) { }
virtual void didCommitAndDrawFrame() { }
+ virtual void scheduleComposite() { }
// Implementation of CCLayerAnimationDelegate
virtual void notifyAnimationStarted(double time) { }
@@ -284,6 +287,7 @@
virtual void scheduleComposite() OVERRIDE
{
+ m_testHooks->scheduleComposite();
}
private:
@@ -368,10 +372,19 @@
: m_beginning(false)
, m_endWhenBeginReturns(false)
, m_timedOut(false)
- , m_finished(false) { }
+ , m_finished(false)
+ , m_scheduled(false) { }
void doBeginTest();
+ virtual void scheduleComposite()
+ {
+ if (m_scheduled || m_finished)
+ return;
+ m_scheduled = true;
+ callOnMainThread(&CCLayerTreeHostTest::dispatchComposite, this);
+ }
+
static void onEndTest(void* self)
{
ASSERT(isMainThread());
@@ -488,6 +501,14 @@
test->m_layerTreeHost->setVisible(false);
}
+ static void dispatchComposite(void* self)
+ {
+ CCLayerTreeHostTest* test = static_cast<CCLayerTreeHostTest*>(self);
+ test->m_scheduled = false;
+ if (test->m_layerTreeHost && !test->m_finished)
+ test->m_layerTreeHost->composite();
+ }
+
class TimeoutTask : public WebThread::Task {
public:
explicit TimeoutTask(CCLayerTreeHostTest* test)
@@ -576,6 +597,7 @@
bool m_endWhenBeginReturns;
bool m_timedOut;
bool m_finished;
+ bool m_scheduled;
OwnPtr<WebThread> m_webThread;
RefPtr<CCScopedThreadProxy> m_mainThreadProxy;
@@ -1215,7 +1237,10 @@
virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime)
{
- const CCFloatAnimationCurve* curve = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity)->curve()->toFloatAnimationCurve();
+ const CCActiveAnimation* animation = m_layerTreeHost->rootLayer()->layerAnimationController()->getActiveAnimation(0, CCActiveAnimation::Opacity);
+ if (!animation)
+ return;
+ const CCFloatAnimationCurve* curve = animation->curve()->toFloatAnimationCurve();
float startOpacity = curve->getValue(0);
float endOpacity = curve->getValue(curve->duration());
float linearlyInterpolatedOpacity = 0.25 * endOpacity + 0.75 * startOpacity;
@@ -2644,4 +2669,55 @@
runTestThreaded();
}
+class CCLayerTreeHostTestFinishAllRendering : public CCLayerTreeHostTest {
+public:
+ CCLayerTreeHostTestFinishAllRendering()
+ : m_once(false)
+ , m_mutex()
+ , m_drawCount(0)
+ {
+ }
+
+ virtual void beginTest()
+ {
+ m_layerTreeHost->setNeedsRedraw();
+ }
+
+ virtual void didCommitAndDrawFrame()
+ {
+ if (m_once)
+ return;
+ m_once = true;
+ m_layerTreeHost->setNeedsRedraw();
+ m_layerTreeHost->acquireLayerTextures();
+ {
+ Locker<Mutex> lock(m_mutex);
+ m_drawCount = 0;
+ }
+ m_layerTreeHost->finishAllRendering();
+ {
+ Locker<Mutex> lock(m_mutex);
+ EXPECT_EQ(0, m_drawCount);
+ }
+ endTest();
+ }
+
+ virtual void drawLayersOnCCThread(CCLayerTreeHostImpl* impl)
+ {
+ Locker<Mutex> lock(m_mutex);
+ ++m_drawCount;
+ }
+
+ virtual void afterTest()
+ {
+ }
+private:
+
+ bool m_once;
+ Mutex m_mutex;
+ int m_drawCount;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestFinishAllRendering)
+
} // namespace