Title: [126835] trunk/Source
Revision
126835
Author
[email protected]
Date
2012-08-27 19:00:14 -0700 (Mon, 27 Aug 2012)

Log Message

[Chromium] Stop texture updates when context is lost.
https://bugs.webkit.org/show_bug.cgi?id=94983

Patch by David Reveman <[email protected]> on 2012-08-27
Reviewed by James Robinson.

Source/WebCore:

Free m_currentTextureUpdateController when
CCThreadProxy::didLoseContextOnImplThread() is called.

Unit test: CCLayerTreeHostTestLostContextWhileUpdatingResources.runMultiThread

* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::didLoseContextOnImplThread):
(WebCore::CCThreadProxy::scheduledActionCommit):

Source/WebKit/chromium:

* tests/CCLayerTreeHostTest.cpp:
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::setContextLostCallback):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::isContextLost):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::beginQueryEXT):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::endQueryEXT):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::getQueryObjectuivEXT):
(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext):
(CCLayerTreeHostTestLostContextWhileUpdatingResources):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::createOutputSurface):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::beginTest):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::commitCompleteOnCCThread):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::layout):
(CCLayerTreeHostTestLostContextWhileUpdatingResources::afterTest):
(TEST_F):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126834 => 126835)


--- trunk/Source/WebCore/ChangeLog	2012-08-28 01:53:24 UTC (rev 126834)
+++ trunk/Source/WebCore/ChangeLog	2012-08-28 02:00:14 UTC (rev 126835)
@@ -1,3 +1,19 @@
+2012-08-27  David Reveman  <[email protected]>
+
+        [Chromium] Stop texture updates when context is lost.
+        https://bugs.webkit.org/show_bug.cgi?id=94983
+
+        Reviewed by James Robinson.
+
+        Free m_currentTextureUpdateController when
+        CCThreadProxy::didLoseContextOnImplThread() is called.
+
+        Unit test: CCLayerTreeHostTestLostContextWhileUpdatingResources.runMultiThread
+
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::didLoseContextOnImplThread):
+        (WebCore::CCThreadProxy::scheduledActionCommit):
+
 2012-08-27  Dean Jackson  <[email protected]>
 
         Unreviewed attempted build fix for Mac.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (126834 => 126835)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-28 01:53:24 UTC (rev 126834)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-08-28 02:00:14 UTC (rev 126835)
@@ -314,6 +314,7 @@
 {
     ASSERT(isImplThread());
     TRACE_EVENT0("cc", "CCThreadProxy::didLoseContextOnImplThread");
+    m_currentTextureUpdateControllerOnImplThread.clear();
     m_schedulerOnImplThread->didLoseContext();
 }
 
@@ -619,8 +620,7 @@
 {
     TRACE_EVENT0("cc", "CCThreadProxy::scheduledActionCommit");
     ASSERT(isImplThread());
-    ASSERT(m_currentTextureUpdateControllerOnImplThread);
-    ASSERT(!m_currentTextureUpdateControllerOnImplThread->hasMoreUpdates());
+    ASSERT(!hasMoreResourceUpdates());
     ASSERT(m_commitCompletionEventOnImplThread);
 
     m_currentTextureUpdateControllerOnImplThread.clear();

Modified: trunk/Source/WebKit/chromium/ChangeLog (126834 => 126835)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-08-28 01:53:24 UTC (rev 126834)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-08-28 02:00:14 UTC (rev 126835)
@@ -1,3 +1,28 @@
+2012-08-27  David Reveman  <[email protected]>
+
+        [Chromium] Stop texture updates when context is lost.
+        https://bugs.webkit.org/show_bug.cgi?id=94983
+
+        Reviewed by James Robinson.
+
+        * tests/CCLayerTreeHostTest.cpp:
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::setContextLostCallback):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::isContextLost):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::beginQueryEXT):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::endQueryEXT):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::getQueryObjectuivEXT):
+        (CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::CCLayerTreeHostTestLostContextWhileUpdatingResources):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::createOutputSurface):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::beginTest):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::commitCompleteOnCCThread):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::layout):
+        (CCLayerTreeHostTestLostContextWhileUpdatingResources::afterTest):
+        (TEST_F):
+
 2012-08-27  Dana Jansens  <[email protected]>
 
         [chromium] A general mechanism for passing data into and out of appendQuads and quadCuller via CCAppendQuadsData

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (126834 => 126835)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-08-28 01:53:24 UTC (rev 126834)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-08-28 02:00:14 UTC (rev 126835)
@@ -35,6 +35,8 @@
 #include "CCThreadedTest.h"
 #include "CCTimingFunction.h"
 #include "ContentLayerChromium.h"
+#include "Extensions3DChromium.h"
+#include "FakeWebCompositorOutputSurface.h"
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
 #include <public/Platform.h>
@@ -2688,4 +2690,96 @@
 
 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestLostContextAfterEvictTextures)
 
+class CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext : public WebKit::CompositorFakeWebGraphicsContext3D {
+public:
+    static PassOwnPtr<CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext> create(Attributes attrs)
+    {
+        return adoptPtr(new CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(attrs));
+    }
+
+    virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) { m_contextLostCallback = callback; }
+    virtual bool isContextLost() { return m_isContextLost; }
+
+    virtual void beginQueryEXT(GC3Denum, WebGLId) { }
+    virtual void endQueryEXT(GC3Denum)
+    {
+        // Lose context.
+        if (!m_isContextLost) {
+            m_contextLostCallback->onContextLost();
+            m_isContextLost = true;
+        }
+    }
+    virtual void getQueryObjectuivEXT(WebGLId, GC3Denum pname, GC3Duint* params)
+    {
+        // Context is lost. Result will never be available.
+        if (pname == Extensions3DChromium::QUERY_RESULT_AVAILABLE_EXT)
+            *params = 0;
+    }
+
+private:
+    explicit CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext(Attributes attrs)
+        : CompositorFakeWebGraphicsContext3D(attrs)
+        , m_contextLostCallback(0)
+        , m_isContextLost(false) { }
+
+    WebGraphicsContextLostCallback* m_contextLostCallback;
+    bool m_isContextLost;
+};
+
+class CCLayerTreeHostTestLostContextWhileUpdatingResources : public CCLayerTreeHostTest {
+public:
+    CCLayerTreeHostTestLostContextWhileUpdatingResources()
+        : m_parent(ContentLayerChromiumWithUpdateTracking::create(&m_delegate))
+        , m_numChildren(50)
+    {
+        for (int i = 0; i < m_numChildren; i++)
+            m_children.append(ContentLayerChromiumWithUpdateTracking::create(&m_delegate));
+    }
+
+    virtual PassOwnPtr<WebKit::WebCompositorOutputSurface> createOutputSurface()
+    {
+        return FakeWebCompositorOutputSurface::create(CompositorFakeWebGraphicsContext3DWithEndQueryCausingLostContext::create(WebGraphicsContext3D::Attributes()));
+    }
+
+    virtual void beginTest()
+    {
+        m_layerTreeHost->setRootLayer(m_parent);
+        m_layerTreeHost->setViewportSize(IntSize(m_numChildren, 1), IntSize(m_numChildren, 1));
+
+        WebTransformationMatrix identityMatrix;
+        setLayerPropertiesForTesting(m_parent.get(), 0, identityMatrix, FloatPoint(0, 0), FloatPoint(0, 0), IntSize(m_numChildren, 1), true);
+        for (int i = 0; i < m_numChildren; i++)
+            setLayerPropertiesForTesting(m_children[i].get(), m_parent.get(), identityMatrix, FloatPoint(0, 0), FloatPoint(i, 0), IntSize(1, 1), false);
+
+        postSetNeedsCommitToMainThread();
+    }
+
+    virtual void commitCompleteOnCCThread(CCLayerTreeHostImpl* impl)
+    {
+        endTest();
+    }
+
+    virtual void layout()
+    {
+        m_parent->setNeedsDisplay();
+        for (int i = 0; i < m_numChildren; i++)
+            m_children[i]->setNeedsDisplay();
+    }
+
+    virtual void afterTest()
+    {
+    }
+
+private:
+    MockContentLayerDelegate m_delegate;
+    RefPtr<ContentLayerChromiumWithUpdateTracking> m_parent;
+    int m_numChildren;
+    Vector<RefPtr<ContentLayerChromiumWithUpdateTracking> > m_children;
+};
+
+TEST_F(CCLayerTreeHostTestLostContextWhileUpdatingResources, runMultiThread)
+{
+    runTest(true);
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to