Title: [109411] trunk/Source
Revision
109411
Author
[email protected]
Date
2012-03-01 13:42:45 -0800 (Thu, 01 Mar 2012)

Log Message

[chromium] Move context lost control code from CCSingleThreadProxy to CCLayerTreeHost
https://bugs.webkit.org/show_bug.cgi?id=79964

Reviewed by James Robinson.

Source/WebCore:

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::CCLayerTreeHost):
(WebCore::CCLayerTreeHost::initializeLayerRenderer):
(WebCore::CCLayerTreeHost::recreateContext):
(WebCore::CCLayerTreeHost::createContext):
(WebCore::CCLayerTreeHost::didLoseContext):
(WebCore::CCLayerTreeHost::compositeAndReadback):
(WebCore::CCLayerTreeHost::loseContext):
(WebCore::CCLayerTreeHost::updateLayers):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHostClient):
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCProxy.h:
(CCProxy):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::CCSingleThreadProxy):
(WebCore::CCSingleThreadProxy::compositeAndReadback):
(WebCore::CCSingleThreadProxy::initializeContext):
(WebCore::CCSingleThreadProxy::recreateContext):
(WebCore):
(WebCore::CCSingleThreadProxy::loseContext):
(WebCore::CCSingleThreadProxy::compositeImmediately):
(WebCore::CCSingleThreadProxy::doComposite):
* platform/graphics/chromium/cc/CCSingleThreadProxy.h:
(CCSingleThreadProxy):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::initializeContext):
(WebCore::CCThreadProxy::recreateContext):
(WebCore):
(WebCore::CCThreadProxy::loseContext):
* platform/graphics/chromium/cc/CCThreadProxy.h:
(CCThreadProxy):

Source/WebKit/chromium:

* src/WebLayerTreeView.cpp:
(WebKit::WebLayerTreeView::loseCompositorContext):
* src/WebLayerTreeViewImpl.cpp:
(WebKit::WebLayerTreeViewImpl::createContext):
(WebKit::WebLayerTreeViewImpl::didRecreateContext):
* src/WebLayerTreeViewImpl.h:
(WebLayerTreeViewImpl):
* tests/CCLayerTreeHostTest.cpp:
(WTF::MockLayerTreeHostClient::createContext):
(WTF::MockLayerTreeHostClient::didRecreateContext):
* tests/FakeCCLayerTreeHostClient.h:
(WebCore::FakeCCLayerTreeHostClient::createContext):
(WebCore::FakeCCLayerTreeHostClient::didRecreateContext):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (109410 => 109411)


--- trunk/Source/WebCore/ChangeLog	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/ChangeLog	2012-03-01 21:42:45 UTC (rev 109411)
@@ -1,3 +1,43 @@
+2012-02-29  Nat Duca  <[email protected]>
+
+        [chromium] Move context lost control code from CCSingleThreadProxy to CCLayerTreeHost
+        https://bugs.webkit.org/show_bug.cgi?id=79964
+
+        Reviewed by James Robinson.
+
+        * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+        (WebCore::CCLayerTreeHost::CCLayerTreeHost):
+        (WebCore::CCLayerTreeHost::initializeLayerRenderer):
+        (WebCore::CCLayerTreeHost::recreateContext):
+        (WebCore::CCLayerTreeHost::createContext):
+        (WebCore::CCLayerTreeHost::didLoseContext):
+        (WebCore::CCLayerTreeHost::compositeAndReadback):
+        (WebCore::CCLayerTreeHost::loseContext):
+        (WebCore::CCLayerTreeHost::updateLayers):
+        * platform/graphics/chromium/cc/CCLayerTreeHost.h:
+        (CCLayerTreeHostClient):
+        (CCLayerTreeHost):
+        * platform/graphics/chromium/cc/CCProxy.h:
+        (CCProxy):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
+        (WebCore::CCSingleThreadProxy::CCSingleThreadProxy):
+        (WebCore::CCSingleThreadProxy::compositeAndReadback):
+        (WebCore::CCSingleThreadProxy::initializeContext):
+        (WebCore::CCSingleThreadProxy::recreateContext):
+        (WebCore):
+        (WebCore::CCSingleThreadProxy::loseContext):
+        (WebCore::CCSingleThreadProxy::compositeImmediately):
+        (WebCore::CCSingleThreadProxy::doComposite):
+        * platform/graphics/chromium/cc/CCSingleThreadProxy.h:
+        (CCSingleThreadProxy):
+        * platform/graphics/chromium/cc/CCThreadProxy.cpp:
+        (WebCore::CCThreadProxy::initializeContext):
+        (WebCore::CCThreadProxy::recreateContext):
+        (WebCore):
+        (WebCore::CCThreadProxy::loseContext):
+        * platform/graphics/chromium/cc/CCThreadProxy.h:
+        (CCThreadProxy):
+
 2012-03-01  Abhishek Arya  <[email protected]>
 
         Prevent layout root to remain set on renderers getting destroyed.

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -66,6 +66,9 @@
     , m_client(client)
     , m_frameNumber(0)
     , m_layerRendererInitialized(false)
+    , m_contextLost(false)
+    , m_numTimesRecreateShouldFail(0)
+    , m_numFailedRecreateAttempts(0)
     , m_settings(settings)
     , m_visible(true)
     , m_pageScaleFactor(1)
@@ -114,7 +117,7 @@
     TRACE_EVENT("CCLayerTreeHost::initializeLayerRenderer", this, 0);
     if (!m_proxy->initializeLayerRenderer()) {
         // Uh oh, better tell the client that we can't do anything with this context.
-        m_client->didRecreateGraphicsContext(false);
+        m_client->didRecreateContext(false);
         return;
     }
 
@@ -131,7 +134,36 @@
     m_layerRendererInitialized = true;
 }
 
+void CCLayerTreeHost::recreateContext()
+{
+    TRACE_EVENT0("cc", "CCLayerTreeHost::recreateContext");
+    ASSERT(m_contextLost);
 
+    bool recreated = false;
+    if (!m_numTimesRecreateShouldFail)
+        recreated = m_proxy->recreateContext();
+    else
+        m_numTimesRecreateShouldFail--;
+
+    if (recreated) {
+        m_client->didRecreateContext(true);
+        m_contextLost = false;
+        return;
+    }
+
+    // Tolerate a certain number of recreation failures to work around races
+    // in the context-lost machinery.
+    m_numFailedRecreateAttempts++;
+    if (m_numFailedRecreateAttempts < 5) {
+        setNeedsCommit();
+        return;
+    }
+
+    // We have tried too many times to recreate the context. Tell the host to fall
+    // back to software rendering.
+    m_client->didRecreateContext(false);
+}
+
 void CCLayerTreeHost::deleteContentsTexturesOnImplThread(TextureAllocator* allocator)
 {
     ASSERT(CCProxy::isImplThread());
@@ -189,9 +221,9 @@
     m_contentsTextureManager->unprotectAllTextures();
 }
 
-PassRefPtr<GraphicsContext3D> CCLayerTreeHost::createLayerTreeHostContext3D()
+PassRefPtr<GraphicsContext3D> CCLayerTreeHost::createContext()
 {
-    return m_client->createLayerTreeHostContext3D();
+    return m_client->createContext();
 }
 
 PassOwnPtr<CCLayerTreeHostImpl> CCLayerTreeHost::createLayerTreeHostImpl(CCLayerTreeHostImplClient* client)
@@ -199,9 +231,13 @@
     return CCLayerTreeHostImpl::create(m_settings, client);
 }
 
-void CCLayerTreeHost::didRecreateGraphicsContext(bool success)
+void CCLayerTreeHost::didLoseContext()
 {
-    m_client->didRecreateGraphicsContext(success);
+    TRACE_EVENT("CCLayerTreeHost::didLoseContext", 0, this);
+    ASSERT(CCProxy::isMainThread());
+    m_contextLost = true;
+    m_numFailedRecreateAttempts = 0;
+    setNeedsCommit();
 }
 
 // Temporary hack until WebViewImpl context creation gets simplified
@@ -218,6 +254,11 @@
         if (!m_layerRendererInitialized)
             return false;
     }
+    if (m_contextLost) {
+        recreateContext();
+        if (m_contextLost)
+            return false;
+    }
     m_triggerIdlePaints = false;
     bool ret = m_proxy->compositeAndReadback(pixels, rect);
     m_triggerIdlePaints = true;
@@ -351,9 +392,11 @@
     m_proxy->startPageScaleAnimation(targetPosition, useAnchor, scale, durationSec);
 }
 
-void CCLayerTreeHost::loseCompositorContext(int numTimes)
+void CCLayerTreeHost::loseContext(int numTimes)
 {
-    m_proxy->loseCompositorContext(numTimes);
+    TRACE_EVENT1("cc", "CCLayerTreeHost::loseCompositorContext", "numTimes", numTimes);
+    m_numTimesRecreateShouldFail = numTimes - 1;
+    m_proxy->loseContext();
 }
 
 TextureManager* CCLayerTreeHost::contentsTextureManager() const
@@ -375,6 +418,11 @@
         if (!m_layerRendererInitialized)
             return false;
     }
+    if (m_contextLost) {
+        recreateContext();
+        if (m_contextLost)
+            return false;
+    }
 
     if (!rootLayer())
         return true;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -55,8 +55,8 @@
     virtual void updateAnimations(double frameBeginTime) = 0;
     virtual void layout() = 0;
     virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) = 0;
-    virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D() = 0;
-    virtual void didRecreateGraphicsContext(bool success) = 0;
+    virtual PassRefPtr<GraphicsContext3D> createContext() = 0;
+    virtual void didRecreateContext(bool success) = 0;
     virtual void didCommitAndDrawFrame() = 0;
     virtual void didCompleteSwapBuffers() = 0;
 
@@ -130,13 +130,15 @@
     void beginCommitOnImplThread(CCLayerTreeHostImpl*);
     void finishCommitOnImplThread(CCLayerTreeHostImpl*);
     void commitComplete();
-    PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D();
+    PassRefPtr<GraphicsContext3D> createContext();
     virtual PassOwnPtr<CCLayerTreeHostImpl> createLayerTreeHostImpl(CCLayerTreeHostImplClient*);
     void didBecomeInvisibleOnImplThread(CCLayerTreeHostImpl*);
-    void didRecreateGraphicsContext(bool success);
+    void didLoseContext();
     void didCommitAndDrawFrame() { m_client->didCommitAndDrawFrame(); }
     void didCompleteSwapBuffers() { m_client->didCompleteSwapBuffers(); }
     void deleteContentsTexturesOnImplThread(TextureAllocator*);
+    // Returns false if we should abort this frame due to initialization failure.
+    bool updateLayers();
 
     CCLayerTreeHostClient* client() { return m_client; }
 
@@ -159,7 +161,7 @@
     const LayerRendererCapabilities& layerRendererCapabilities() const;
 
     // Test only hook
-    void loseCompositorContext(int numTimes);
+    void loseContext(int numTimes);
 
     void setNeedsAnimate();
     // virtual for testing
@@ -185,9 +187,6 @@
     bool visible() const { return m_visible; }
     void setVisible(bool);
 
-    // Returns false if we should abort this frame due to initialization failure.
-    bool updateLayers();
-
     void startPageScaleAnimation(const IntSize& targetPosition, bool useAnchor, float scale, double durationSec);
 
     void updateCompositorResources(GraphicsContext3D*, CCTextureUpdater&);
@@ -207,6 +206,7 @@
     typedef Vector<OwnPtr<ManagedTexture> > TextureList;
 
     void initializeLayerRenderer();
+    void recreateContext();
 
     enum PaintType { PaintVisible, PaintIdle };
     static void paintContentsIfDirty(LayerChromium*, PaintType, const Region& occludedScreenSpace);
@@ -230,6 +230,9 @@
 
     OwnPtr<CCProxy> m_proxy;
     bool m_layerRendererInitialized;
+    bool m_contextLost;
+    int m_numTimesRecreateShouldFail;
+    int m_numFailedRecreateAttempts;
 
     RefPtr<LayerChromium> m_rootLayer;
     OwnPtr<TextureManager> m_contentsTextureManager;

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -70,6 +70,10 @@
     // Attempts to initialize the layer renderer. Returns false if the context isn't usable for compositing.
     virtual bool initializeLayerRenderer() = 0;
 
+    // Attempts to recreate the context and layer renderer after a context lost. Returns false if the renderer couldn't be
+    // reinitialized.
+    virtual bool recreateContext() = 0;
+
     virtual int compositorIdentifier() const = 0;
 
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const = 0;
@@ -95,7 +99,7 @@
     virtual GraphicsContext3D* context() = 0;
 
     // Testing hooks
-    virtual void loseCompositorContext(int numTimes) = 0;
+    virtual void loseContext() = 0;
 
 #ifndef NDEBUG
     static void setCurrentThreadIsImplThread(bool);

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -45,11 +45,9 @@
 
 CCSingleThreadProxy::CCSingleThreadProxy(CCLayerTreeHost* layerTreeHost)
     : m_layerTreeHost(layerTreeHost)
+    , m_contextLost(false)
     , m_compositorIdentifier(-1)
     , m_layerRendererInitialized(false)
-    , m_numFailedRecreateAttempts(0)
-    , m_graphicsContextLost(false)
-    , m_timesRecreateShouldFail(0)
     , m_nextFrameIsNewlyCommittedFrame(false)
 {
     TRACE_EVENT("CCSingleThreadProxy::CCSingleThreadProxy", this, 0);
@@ -74,11 +72,6 @@
     TRACE_EVENT("CCSingleThreadProxy::compositeAndReadback", this, 0);
     ASSERT(CCProxy::isMainThread());
 
-    if (!recreateContextIfNeeded()) {
-        TRACE_EVENT("compositeAndReadback_EarlyOut_ContextLost", this, 0);
-        return false;
-    }
-
     if (!commitIfNeeded())
         return false;
 
@@ -125,7 +118,7 @@
 bool CCSingleThreadProxy::initializeContext()
 {
     ASSERT(CCProxy::isMainThread());
-    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D();
+    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     if (!context)
         return false;
     ASSERT(context->hasOneRef());
@@ -148,6 +141,32 @@
     }
 }
 
+bool CCSingleThreadProxy::recreateContext()
+{
+    TRACE_EVENT0("cc", "CCSingleThreadProxy::recreateContext");
+    ASSERT(CCProxy::isMainThread());
+    ASSERT(m_contextLost);
+
+    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
+    if (!context)
+        return false;
+
+    ASSERT(context->hasOneRef());
+    bool initialized;
+    {
+        DebugScopedSetImplThread impl;
+        m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
+        initialized = m_layerTreeHostImpl->initializeLayerRenderer(context);
+        if (initialized)
+            m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities();
+    }
+
+    if (initialized)
+        m_contextLost = false;
+
+    return initialized;
+}
+
 const LayerRendererCapabilities& CCSingleThreadProxy::layerRendererCapabilities() const
 {
     ASSERT(m_layerRendererInitialized);
@@ -155,10 +174,11 @@
     return m_layerRendererCapabilitiesForMainThread;
 }
 
-void CCSingleThreadProxy::loseCompositorContext(int numTimes)
+void CCSingleThreadProxy::loseContext()
 {
-    m_graphicsContextLost = true;
-    m_timesRecreateShouldFail = numTimes - 1;
+    ASSERT(CCProxy::isMainThread());
+    m_layerTreeHost->didLoseContext();
+    m_contextLost = true;
 }
 
 void CCSingleThreadProxy::setNeedsAnimate()
@@ -243,9 +263,6 @@
 // Called by the legacy scheduling path (e.g. where render_widget does the scheduling)
 void CCSingleThreadProxy::compositeImmediately()
 {
-    if (!recreateContextIfNeeded())
-        return;
-
     if (!commitIfNeeded())
         return;
 
@@ -253,54 +270,6 @@
         m_layerTreeHostImpl->swapBuffers();
 }
 
-bool CCSingleThreadProxy::recreateContextIfNeeded()
-{
-    ASSERT(CCProxy::isMainThread());
-
-    if (!m_graphicsContextLost && m_layerTreeHostImpl->isContextLost()) {
-        m_graphicsContextLost = true;
-        m_numFailedRecreateAttempts = 0;
-    }
-
-    if (!m_graphicsContextLost)
-        return true;
-    RefPtr<GraphicsContext3D> context;
-    if (!m_timesRecreateShouldFail)
-        context = m_layerTreeHost->createLayerTreeHostContext3D();
-    else
-        m_timesRecreateShouldFail--;
-
-    if (context) {
-        ASSERT(context->hasOneRef());
-        bool ok;
-        {
-            DebugScopedSetImplThread impl;
-            m_layerTreeHost->deleteContentsTexturesOnImplThread(m_layerTreeHostImpl->contentsTextureAllocator());
-            ok = m_layerTreeHostImpl->initializeLayerRenderer(context);
-            if (ok)
-                m_layerRendererCapabilitiesForMainThread = m_layerTreeHostImpl->layerRendererCapabilities();
-        }
-        if (ok) {
-            m_layerTreeHost->didRecreateGraphicsContext(true);
-            m_graphicsContextLost = false;
-            return true;
-        }
-    }
-
-    // Tolerate a certain number of recreation failures to work around races
-    // in the context-lost machinery.
-    m_numFailedRecreateAttempts++;
-    if (m_numFailedRecreateAttempts < 5) {
-        setNeedsCommit();
-        return false;
-    }
-
-    // We have tried too many times to recreate the context. Tell the host to fall
-    // back to software rendering.
-    m_layerTreeHost->didRecreateGraphicsContext(false);
-    return false;
-}
-
 bool CCSingleThreadProxy::commitIfNeeded()
 {
     ASSERT(CCProxy::isMainThread());
@@ -314,8 +283,7 @@
 
 bool CCSingleThreadProxy::doComposite()
 {
-    ASSERT(!m_graphicsContextLost);
-
+    ASSERT(!m_contextLost);
     {
       DebugScopedSetImplThread impl;
       double frameDisplayTimeMs = monotonicallyIncreasingTime() * 1000.0;
@@ -324,15 +292,8 @@
     }
 
     if (m_layerTreeHostImpl->isContextLost()) {
-        // Trying to recover the context right here will not work if GPU process
-        // died. This is because GpuChannelHost::OnErrorMessage will only be
-        // called at the next iteration of the message loop, reverting our
-        // recovery attempts here. Instead, we detach the root layer from the
-        // renderer, recreate the renderer at the next message loop iteration
-        // and request a repaint yet again.
-        m_graphicsContextLost = true;
-        m_numFailedRecreateAttempts = 0;
-        setNeedsCommit();
+        m_contextLost = true;
+        m_layerTreeHost->didLoseContext();
         return false;
     }
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -49,9 +49,10 @@
     virtual bool isStarted() const;
     virtual bool initializeContext();
     virtual bool initializeLayerRenderer();
+    virtual bool recreateContext();
     virtual int compositorIdentifier() const { return m_compositorIdentifier; }
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const;
-    virtual void loseCompositorContext(int numTimes);
+    virtual void loseContext();
     virtual void setNeedsAnimate();
     virtual void setNeedsCommit();
     virtual void setNeedsRedraw();
@@ -71,13 +72,14 @@
 
 private:
     explicit CCSingleThreadProxy(CCLayerTreeHost*);
-    bool recreateContextIfNeeded();
+
     bool commitIfNeeded();
     void doCommit();
     bool doComposite();
 
     // Accessed on main thread only.
     CCLayerTreeHost* m_layerTreeHost;
+    bool m_contextLost;
     int m_compositorIdentifier;
 
     // Holds on to the context between initializeContext() and initializeLayerRenderer() calls. Shouldn't
@@ -89,9 +91,6 @@
     bool m_layerRendererInitialized;
     LayerRendererCapabilities m_layerRendererCapabilitiesForMainThread;
 
-    int m_numFailedRecreateAttempts;
-    bool m_graphicsContextLost;
-    int m_timesRecreateShouldFail; // Used during testing.
     bool m_nextFrameIsNewlyCommittedFrame;
 };
 

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


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -170,7 +170,7 @@
 bool CCThreadProxy::initializeContext()
 {
     TRACE_EVENT("CCThreadProxy::initializeContext", this, 0);
-    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createLayerTreeHostContext3D();
+    RefPtr<GraphicsContext3D> context = m_layerTreeHost->createContext();
     if (!context)
         return false;
     ASSERT(context->hasOneRef());
@@ -205,6 +205,12 @@
     return initializeSucceeded;
 }
 
+bool CCThreadProxy::recreateContext()
+{
+    ASSERT_NOT_REACHED();
+    return false;
+}
+
 int CCThreadProxy::compositorIdentifier() const
 {
     ASSERT(isMainThread());
@@ -217,7 +223,7 @@
     return m_layerRendererCapabilitiesMainThreadCopy;
 }
 
-void CCThreadProxy::loseCompositorContext(int numTimes)
+void CCThreadProxy::loseContext()
 {
     ASSERT_NOT_REACHED();
 }

Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h (109410 => 109411)


--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -56,9 +56,10 @@
     virtual bool isStarted() const;
     virtual bool initializeContext();
     virtual bool initializeLayerRenderer();
+    virtual bool recreateContext();
     virtual int compositorIdentifier() const;
     virtual const LayerRendererCapabilities& layerRendererCapabilities() const;
-    virtual void loseCompositorContext(int numTimes);
+    virtual void loseContext();
     virtual void setNeedsAnimate();
     virtual void setNeedsCommit();
     virtual void setNeedsRedraw();

Modified: trunk/Source/WebKit/chromium/ChangeLog (109410 => 109411)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-01 21:42:45 UTC (rev 109411)
@@ -1,3 +1,24 @@
+2012-02-29  Nat Duca  <[email protected]>
+
+        [chromium] Move context lost control code from CCSingleThreadProxy to CCLayerTreeHost
+        https://bugs.webkit.org/show_bug.cgi?id=79964
+
+        Reviewed by James Robinson.
+
+        * src/WebLayerTreeView.cpp:
+        (WebKit::WebLayerTreeView::loseCompositorContext):
+        * src/WebLayerTreeViewImpl.cpp:
+        (WebKit::WebLayerTreeViewImpl::createContext):
+        (WebKit::WebLayerTreeViewImpl::didRecreateContext):
+        * src/WebLayerTreeViewImpl.h:
+        (WebLayerTreeViewImpl):
+        * tests/CCLayerTreeHostTest.cpp:
+        (WTF::MockLayerTreeHostClient::createContext):
+        (WTF::MockLayerTreeHostClient::didRecreateContext):
+        * tests/FakeCCLayerTreeHostClient.h:
+        (WebCore::FakeCCLayerTreeHostClient::createContext):
+        (WebCore::FakeCCLayerTreeHostClient::didRecreateContext):
+
 2012-03-01  Kentaro Hara  <[email protected]>
 
         REGRESSION(r109288): WebViewImpl::enableAutoResizeMode loops infinitely

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp (109410 => 109411)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeView.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -152,7 +152,7 @@
 
 void WebLayerTreeView::loseCompositorContext(int numTimes)
 {
-    m_private->loseCompositorContext(numTimes);
+    m_private->loseContext(numTimes);
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp (109410 => 109411)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -78,7 +78,7 @@
         m_client->applyScrollAndScale(WebSize(scrollDelta), pageScale);
 }
 
-PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createLayerTreeHostContext3D()
+PassRefPtr<GraphicsContext3D> WebLayerTreeViewImpl::createContext()
 {
     if (!m_client)
         return 0;
@@ -89,7 +89,7 @@
     return GraphicsContext3DPrivate::createGraphicsContextFromWebContext(webContext.release(), GraphicsContext3D::RenderDirectlyToHostWindow, false /* preserveDrawingBuffer */ );
 }
 
-void WebLayerTreeViewImpl::didRecreateGraphicsContext(bool success)
+void WebLayerTreeViewImpl::didRecreateContext(bool success)
 {
     if (m_client)
         m_client->didRebindGraphicsContext(success);

Modified: trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h (109410 => 109411)


--- trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -44,8 +44,8 @@
     virtual void updateAnimations(double frameBeginTime);
     virtual void layout();
     virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale);
-    virtual PassRefPtr<WebCore::GraphicsContext3D> createLayerTreeHostContext3D();
-    virtual void didRecreateGraphicsContext(bool success);
+    virtual PassRefPtr<WebCore::GraphicsContext3D> createContext();
+    virtual void didRecreateContext(bool success);
     virtual void didCommitAndDrawFrame();
     virtual void didCompleteSwapBuffers();
 

Modified: trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (109410 => 109411)


--- trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-03-01 21:42:45 UTC (rev 109411)
@@ -227,7 +227,7 @@
         m_testHooks->applyScrollAndScale(scrollDelta, scale);
     }
 
-    virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D()
+    virtual PassRefPtr<GraphicsContext3D> createContext()
     {
         GraphicsContext3D::Attributes attrs;
         WebGraphicsContext3D::Attributes webAttrs;
@@ -245,7 +245,7 @@
     {
     }
 
-    virtual void didRecreateGraphicsContext(bool)
+    virtual void didRecreateContext(bool)
     {
     }
 

Modified: trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h (109410 => 109411)


--- trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h	2012-03-01 21:39:01 UTC (rev 109410)
+++ trunk/Source/WebKit/chromium/tests/FakeCCLayerTreeHostClient.h	2012-03-01 21:42:45 UTC (rev 109411)
@@ -37,12 +37,12 @@
     virtual void updateAnimations(double frameBeginTime) { }
     virtual void layout() { }
     virtual void applyScrollAndScale(const IntSize& scrollDelta, float pageScale) { }
-    virtual PassRefPtr<GraphicsContext3D> createLayerTreeHostContext3D()
+    virtual PassRefPtr<GraphicsContext3D> createContext()
     {
         GraphicsContext3D::Attributes attrs;
         return createCompositorMockGraphicsContext3D(attrs);
     }
-    virtual void didRecreateGraphicsContext(bool success) { }
+    virtual void didRecreateContext(bool success) { }
     virtual void didCommitAndDrawFrame() { }
     virtual void didCompleteSwapBuffers() { }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to