Title: [137958] trunk/Source/WebKit2
Revision
137958
Author
[email protected]
Date
2012-12-17 16:26:50 -0800 (Mon, 17 Dec 2012)

Log Message

[CoordinatedGraphics] Assertion hit in WebKit::LayerTreeRenderer::setLayerState()
https://bugs.webkit.org/show_bug.cgi?id=104518

Patch by Huang Dongsung <[email protected]> on 2012-12-17
Reviewed by Noam Rosenthal.

CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() must perform
only during flushing pending layer changes in CoordinatedLayerTreeHost.
RenderLayerCompositor can call GraphicsLayer::flushCompositingState() regardless
of CoordinatedLayerTreeHost and it breaks our assumption. It means that
CoordinatedGraphicsLayer can send messages although m_waitingForUIProcess in
CoordinatedLayerTreeHost is true.

Assertion hits because of the same reason. If RenderLayerCompositor calls
flushCompositingState() before the first CoordinatedLayerTreeHost::flushPendingLayerChanges(),
SetCompositingLayerState message can be prior to SetRootCompositingLayer message.

We fix this by ensuring that we perform the layer flush only in the code
path originating from CoordinatedLayerTreeHost.

* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::flushCompositingState):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
(CoordinatedGraphicsLayerClient):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
(WebKit::CoordinatedLayerTreeHost::flushPendingLayerChanges):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (137957 => 137958)


--- trunk/Source/WebKit2/ChangeLog	2012-12-18 00:26:31 UTC (rev 137957)
+++ trunk/Source/WebKit2/ChangeLog	2012-12-18 00:26:50 UTC (rev 137958)
@@ -1,3 +1,34 @@
+2012-12-17  Huang Dongsung  <[email protected]>
+
+        [CoordinatedGraphics] Assertion hit in WebKit::LayerTreeRenderer::setLayerState()
+        https://bugs.webkit.org/show_bug.cgi?id=104518
+
+        Reviewed by Noam Rosenthal.
+
+        CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly() must perform
+        only during flushing pending layer changes in CoordinatedLayerTreeHost.
+        RenderLayerCompositor can call GraphicsLayer::flushCompositingState() regardless
+        of CoordinatedLayerTreeHost and it breaks our assumption. It means that
+        CoordinatedGraphicsLayer can send messages although m_waitingForUIProcess in
+        CoordinatedLayerTreeHost is true.
+
+        Assertion hits because of the same reason. If RenderLayerCompositor calls
+        flushCompositingState() before the first CoordinatedLayerTreeHost::flushPendingLayerChanges(),
+        SetCompositingLayerState message can be prior to SetRootCompositingLayer message.
+
+        We fix this by ensuring that we perform the layer flush only in the code
+        path originating from CoordinatedLayerTreeHost.
+
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::flushCompositingState):
+        (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h:
+        (CoordinatedGraphicsLayerClient):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+        (WebKit::CoordinatedLayerTreeHost::flushPendingLayerChanges):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+
 2012-12-17  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/12895354> NetworkProcess should not exit after downloading

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp (137957 => 137958)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2012-12-18 00:26:31 UTC (rev 137957)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.cpp	2012-12-18 00:26:50 UTC (rev 137958)
@@ -439,6 +439,12 @@
 
 void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect)
 {
+    if (!m_coordinator->isFlushingLayerChanges()) {
+        if (client())
+            client()->notifyFlushRequired(this);
+        return;
+    }
+
     if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer()))
         mask->flushCompositingStateForThisLayerOnly();
 
@@ -585,6 +591,8 @@
 
 void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
 {
+    ASSERT(m_coordinator->isFlushingLayerChanges());
+
     // Sets the values.
     computePixelAlignment(m_adjustedPosition, m_adjustedSize, m_adjustedAnchorPoint, m_pixelAlignmentOffset);
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h (137957 => 137958)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h	2012-12-18 00:26:31 UTC (rev 137957)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedGraphicsLayer.h	2012-12-18 00:26:50 UTC (rev 137958)
@@ -51,6 +51,8 @@
 
 class CoordinatedGraphicsLayerClient {
 public:
+    virtual bool isFlushingLayerChanges() const = 0;
+
     // CoordinatedTileClient
     virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0;
     virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&) = 0;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (137957 => 137958)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2012-12-18 00:26:31 UTC (rev 137957)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2012-12-18 00:26:50 UTC (rev 137958)
@@ -83,6 +83,7 @@
     , m_notifyAfterScheduledLayerFlush(false)
     , m_isValid(true)
     , m_isPurging(false)
+    , m_isFlushingLayerChanges(false)
     , m_waitingForUIProcess(true)
     , m_isSuspended(false)
     , m_contentsScale(1)
@@ -266,6 +267,8 @@
     if (m_waitingForUIProcess)
         return false;
 
+    TemporaryChange<bool> protector(m_isFlushingLayerChanges, true);
+
     initializeRootCompositingLayerIfNeeded();
 
     m_rootLayer->flushCompositingStateForThisLayerOnly();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (137957 => 137958)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2012-12-18 00:26:31 UTC (rev 137957)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2012-12-18 00:26:50 UTC (rev 137958)
@@ -79,6 +79,7 @@
     virtual void deviceScaleFactorDidChange() { }
     virtual PassRefPtr<CoordinatedImageBacking> createImageBackingIfNeeded(WebCore::Image*) OVERRIDE;
 
+    virtual bool isFlushingLayerChanges() const OVERRIDE { return m_isFlushingLayerChanges; }
     virtual void createTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&);
     virtual void updateTile(CoordinatedLayerID, uint32_t tileID, const SurfaceUpdateInfo&, const WebCore::IntRect&);
     virtual void removeTile(CoordinatedLayerID, uint32_t tileID);
@@ -186,6 +187,7 @@
     bool m_isValid;
     // We don't send the messages related to releasing resources to UI Process during purging, because UI Process already had removed all resources.
     bool m_isPurging;
+    bool m_isFlushingLayerChanges;
 
     bool m_waitingForUIProcess;
     bool m_isSuspended;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to