Title: [122257] branches/chromium/1180/Source
Revision
122257
Author
[email protected]
Date
2012-07-10 13:47:24 -0700 (Tue, 10 Jul 2012)

Log Message

Merge 120858 - [chromium] Separate LayerRenderer initialization from updateLayers
https://bugs.webkit.org/show_bug.cgi?id=89525

Reviewed by Adrienne Walker.

Source/WebCore:

This adds an explicit call to initialize the layer renderer of a given CCLayerTreeHost instead of having it be
implicit in updateLayers(). This way the proxies can control the initialization sequence more closely and do
useful work between the two calls.

Refactor, no change in behavior. Covered by existing tests.

* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::compositeAndReadback):
(WebCore::CCLayerTreeHost::initializeLayerRendererIfNeeded):
(WebCore):
(WebCore::CCLayerTreeHost::updateLayers):
* platform/graphics/chromium/cc/CCLayerTreeHost.h:
(CCLayerTreeHost):
* platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:
(WebCore::CCSingleThreadProxy::commitAndComposite):
* platform/graphics/chromium/cc/CCThreadProxy.cpp:
(WebCore::CCThreadProxy::compositeAndReadback):
(WebCore::CCThreadProxy::beginFrame):

Source/WebKit/chromium:

Update tests to call initializeLayerRendererIfNeeded() before calling updateLayers() to reflect what the proxies
do.

* tests/CCLayerTreeHostTest.cpp:
(WTF::CCLayerTreeHostTestLayerOcclusion::beginTest):
(WTF::CCLayerTreeHostTestLayerOcclusionWithFilters::beginTest):
(WTF::CCLayerTreeHostTestManySurfaces::beginTest):
* tests/TiledLayerChromiumTest.cpp:

[email protected]
Review URL: https://chromiumcodereview.appspot.com/10702135

Modified Paths

Diff

Modified: branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (122256 => 122257)


--- branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp	2012-07-10 20:47:24 UTC (rev 122257)
@@ -299,15 +299,6 @@
 
 bool CCLayerTreeHost::compositeAndReadback(void *pixels, const IntRect& rect)
 {
-    if (!m_layerRendererInitialized) {
-        initializeLayerRenderer();
-        if (!m_layerRendererInitialized)
-            return false;
-    }
-    if (m_contextLost) {
-        if (recreateContext() != RecreateSucceeded)
-            return false;
-    }
     m_triggerIdlePaints = false;
     bool ret = m_proxy->compositeAndReadback(pixels, rect);
     m_triggerIdlePaints = true;
@@ -466,7 +457,7 @@
     m_client->scheduleComposite();
 }
 
-bool CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
+bool CCLayerTreeHost::initializeLayerRendererIfNeeded()
 {
     if (!m_layerRendererInitialized) {
         initializeLayerRenderer();
@@ -478,7 +469,13 @@
         if (recreateContext() != RecreateSucceeded)
             return false;
     }
+    return true;
+}
 
+
+void CCLayerTreeHost::updateLayers(CCTextureUpdater& updater)
+{
+    ASSERT(m_layerRendererInitialized);
     // The visible state and memory allocation are set independently and in
     // arbitrary order, so do not change the memory allocation used for the
     // current commit until both values match intentions.
@@ -491,13 +488,12 @@
     }
 
     if (!rootLayer())
-        return true;
+        return;
 
     if (viewportSize().isEmpty())
-        return true;
+        return;
 
     updateLayers(rootLayer(), updater);
-    return true;
 }
 
 void CCLayerTreeHost::updateLayers(LayerChromium* rootLayer, CCTextureUpdater& updater)

Modified: branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h (122256 => 122257)


--- branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h	2012-07-10 20:47:24 UTC (rev 122257)
@@ -168,7 +168,8 @@
     void deleteContentsTexturesOnImplThread(TextureAllocator*);
     virtual void acquireLayerTextures();
     // Returns false if we should abort this frame due to initialization failure.
-    bool updateLayers(CCTextureUpdater&);
+    bool initializeLayerRendererIfNeeded();
+    void updateLayers(CCTextureUpdater&);
 
     CCLayerTreeHostClient* client() { return m_client; }
 

Modified: branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp (122256 => 122257)


--- branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp	2012-07-10 20:47:24 UTC (rev 122257)
@@ -344,11 +344,12 @@
 {
     ASSERT(CCProxy::isMainThread());
 
+    if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
+        return false;
+
     CCTextureUpdater updater;
+    m_layerTreeHost->updateLayers(updater);
 
-    if (!m_layerTreeHost->updateLayers(updater))
-        return false;
-
     m_layerTreeHost->willCommit();
     doCommit(updater);
     bool result = doComposite();

Modified: branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp (122256 => 122257)


--- branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.cpp	2012-07-10 20:47:24 UTC (rev 122257)
@@ -103,7 +103,7 @@
     ASSERT(isMainThread());
     ASSERT(m_layerTreeHost);
 
-    if (!m_layerRendererInitialized) {
+    if (!m_layerTreeHost->initializeLayerRendererIfNeeded()) {
         TRACE_EVENT("compositeAndReadback_EarlyOut_LR_Uninitialized", this, 0);
         return false;
     }
@@ -509,9 +509,11 @@
     m_commitRequested = false;
     m_forcedCommitRequested = false;
 
-    if (!m_layerTreeHost->updateLayers(*request->updater))
+    if (!m_layerTreeHost->initializeLayerRendererIfNeeded())
         return;
 
+    m_layerTreeHost->updateLayers(*request->updater);
+
     // Once single buffered layers are committed, they cannot be modified until
     // they are drawn by the impl thread.
     m_texturesAcquired = false;

Modified: branches/chromium/1180/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp (122256 => 122257)


--- branches/chromium/1180/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp	2012-07-10 20:47:24 UTC (rev 122257)
@@ -1687,6 +1687,7 @@
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
+        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
         m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
@@ -1894,6 +1895,7 @@
 
         m_layerTreeHost->setRootLayer(rootLayer);
         m_layerTreeHost->setViewportSize(rootLayer->bounds());
+        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
         m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();
@@ -1982,6 +1984,7 @@
 
         m_layerTreeHost->setRootLayer(layers[0].get());
         m_layerTreeHost->setViewportSize(layers[0]->bounds());
+        ASSERT_TRUE(m_layerTreeHost->initializeLayerRendererIfNeeded());
         CCTextureUpdater updater;
         m_layerTreeHost->updateLayers(updater);
         m_layerTreeHost->commitComplete();

Modified: branches/chromium/1180/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp (122256 => 122257)


--- branches/chromium/1180/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-07-10 20:39:46 UTC (rev 122256)
+++ branches/chromium/1180/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp	2012-07-10 20:47:24 UTC (rev 122257)
@@ -798,6 +798,7 @@
     WebKit::WebCompositor::initialize(0);
     FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
     OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, CCLayerTreeSettings());
+    ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded());
 
     // Create two 300 x 300 tiled layers.
     IntSize contentBounds(300, 300);
@@ -881,6 +882,7 @@
 
     FakeCCLayerTreeHostClient fakeCCLayerTreeHostClient;
     OwnPtr<CCLayerTreeHost> ccLayerTreeHost = CCLayerTreeHost::create(&fakeCCLayerTreeHostClient, settings);
+    ASSERT_TRUE(ccLayerTreeHost->initializeLayerRendererIfNeeded());
 
     // Create one 500 x 300 tiled layer.
     IntSize contentBounds(300, 200);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to