Title: [134478] trunk/Source/WebKit2
Revision
134478
Author
[email protected]
Date
2012-11-13 13:46:53 -0800 (Tue, 13 Nov 2012)

Log Message

Store destroyed layers in the remote layer tree transaction
https://bugs.webkit.org/show_bug.cgi?id=102127

Reviewed by Andreas Kling.

* Shared/mac/RemoteLayerTreeTransaction.h:
(RemoteLayerTreeTransaction):
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode):
(WebKit::RemoteLayerTreeTransaction::decode):
(WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
(WebKit):
(WebKit::RemoteLayerTreeTransaction::dump):
* WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
(RemoteGraphicsLayer):
* WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
(WebKit::RemoteGraphicsLayer::~RemoteGraphicsLayer):
(WebKit::RemoteGraphicsLayer::removeFromParent):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
(RemoteLayerTreeContext):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
(WebKit::RemoteLayerTreeContext::flushLayers):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (134477 => 134478)


--- trunk/Source/WebKit2/ChangeLog	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-13 21:46:53 UTC (rev 134478)
@@ -1,3 +1,29 @@
+2012-11-13  Anders Carlsson  <[email protected]>
+
+        Store destroyed layers in the remote layer tree transaction
+        https://bugs.webkit.org/show_bug.cgi?id=102127
+
+        Reviewed by Andreas Kling.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (RemoteLayerTreeTransaction):
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::encode):
+        (WebKit::RemoteLayerTreeTransaction::decode):
+        (WebKit::RemoteLayerTreeTransaction::setDestroyedLayerIDs):
+        (WebKit):
+        (WebKit::RemoteLayerTreeTransaction::dump):
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.h:
+        (RemoteGraphicsLayer):
+        * WebProcess/WebPage/mac/RemoteGraphicsLayer.mm:
+        (WebKit::RemoteGraphicsLayer::~RemoteGraphicsLayer):
+        (WebKit::RemoteGraphicsLayer::removeFromParent):
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        (RemoteLayerTreeContext):
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
+        (WebKit::RemoteLayerTreeContext::flushLayers):
+
 2012-11-13  Timothy Hatcher  <[email protected]>
 
         Adjust the Web Inspector window title frame if needed to prevent it from intersecting the dock button.

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (134477 => 134478)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h	2012-11-13 21:46:53 UTC (rev 134478)
@@ -70,8 +70,9 @@
     void encode(CoreIPC::ArgumentEncoder&) const;
     static bool decode(CoreIPC::ArgumentDecoder*, RemoteLayerTreeTransaction&);
 
+    void setRootLayerID(uint64_t rootLayerID);
     void layerPropertiesChanged(const RemoteGraphicsLayer*, unsigned changedProperties);
-    void setRootLayerID(uint64_t rootLayerID);
+    void setDestroyedLayerIDs(Vector<uint64_t>);
 
 #ifndef NDEBUG
     void dump() const;
@@ -80,6 +81,7 @@
 private:
     uint64_t m_rootLayerID;
     HashMap<uint64_t, LayerProperties> m_changedLayerProperties;
+    Vector<uint64_t> m_destroyedLayerIDs;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (134477 => 134478)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm	2012-11-13 21:46:53 UTC (rev 134478)
@@ -104,6 +104,7 @@
 {
     encoder << m_rootLayerID;
     encoder << m_changedLayerProperties;
+    encoder << m_destroyedLayerIDs;
 }
 
 bool RemoteLayerTreeTransaction::decode(CoreIPC::ArgumentDecoder* decoder, RemoteLayerTreeTransaction& result)
@@ -116,6 +117,13 @@
     if (!decoder->decode(result.m_changedLayerProperties))
         return false;
 
+    if (!decoder->decode(result.m_destroyedLayerIDs))
+        return false;
+    for (uint64_t layerID: result.m_destroyedLayerIDs) {
+        if (!layerID)
+            return false;
+    }
+
     return true;
 }
 
@@ -153,6 +161,11 @@
         layerProperties.size = graphicsLayer->size();
 }
 
+void RemoteLayerTreeTransaction::setDestroyedLayerIDs(Vector<uint64_t> destroyedLayerIDs)
+{
+    m_destroyedLayerIDs = std::move(destroyedLayerIDs);
+}
+
 #ifndef NDEBUG
 
 static void writeIndent(StringBuilder& builder, int indent)
@@ -194,7 +207,7 @@
             writeIndent(builder, 3);
             builder.append("(children (");
             for (size_t i = 0; i < layerProperties.children.size(); ++i) {
-                if (i != 0)
+                if (i)
                     builder.append(' ');
                 builder.appendNumber(layerProperties.children[i]);
             }
@@ -239,6 +252,16 @@
 
     dumpChangedLayers(builder, m_changedLayerProperties);
 
+    if (!m_destroyedLayerIDs.isEmpty()) {
+        writeIndent(builder, 1);
+        builder.append("(destroyed-layers ");
+        for (size_t i = 0; i < m_destroyedLayerIDs.size(); ++i) {
+            if (i)
+                builder.append(' ');
+            builder.appendNumber(m_destroyedLayerIDs[i]);
+        }
+        builder.append(")\n");
+    }
     builder.append(")\n");
 
     fprintf(stderr, "%s", builder.toString().utf8().data());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h (134477 => 134478)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.h	2012-11-13 21:46:53 UTC (rev 134478)
@@ -52,6 +52,8 @@
     virtual void addChildBelow(WebCore::GraphicsLayer* childLayer, WebCore::GraphicsLayer* sibling);
     virtual bool replaceChild(WebCore::GraphicsLayer* oldChild, WebCore::GraphicsLayer* newChild);
 
+    virtual void removeFromParent() OVERRIDE;
+
     virtual void setPosition(const WebCore::FloatPoint&) OVERRIDE;
     virtual void setSize(const WebCore::FloatSize&) OVERRIDE;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm (134477 => 134478)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteGraphicsLayer.mm	2012-11-13 21:46:53 UTC (rev 134478)
@@ -56,6 +56,7 @@
 
 RemoteGraphicsLayer::~RemoteGraphicsLayer()
 {
+    m_context->layerWillBeDestroyed(this);
 }
 
 void RemoteGraphicsLayer::setName(const String& name)
@@ -110,6 +111,13 @@
     return false;
 }
 
+void RemoteGraphicsLayer::removeFromParent()
+{
+    if (m_parent)
+        static_cast<RemoteGraphicsLayer*>(m_parent)->noteSublayersChanged();
+    GraphicsLayer::removeFromParent();
+}
+
 void RemoteGraphicsLayer::setPosition(const FloatPoint& position)
 {
     if (position == m_position)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (134477 => 134478)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2012-11-13 21:46:53 UTC (rev 134478)
@@ -28,9 +28,11 @@
 
 #include <WebCore/GraphicsLayerFactory.h>
 #include <WebCore/Timer.h>
+#include <wtf/Vector.h>
 
 namespace WebKit {
 
+class RemoteGraphicsLayer;
 class RemoteLayerTreeTransaction;
 class WebPage;
 
@@ -40,6 +42,8 @@
     ~RemoteLayerTreeContext();
 
     void setRootLayer(WebCore::GraphicsLayer*);
+    void layerWillBeDestroyed(RemoteGraphicsLayer*);
+
     void scheduleLayerFlush();
 
     RemoteLayerTreeTransaction& currentTransaction();
@@ -57,6 +61,7 @@
     WebCore::Timer<RemoteLayerTreeContext> m_layerFlushTimer;
 
     uint64_t m_rootLayerID;
+    Vector<uint64_t> m_destroyedLayers;
     RemoteLayerTreeTransaction* m_currentTransaction;
 };
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (134477 => 134478)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2012-11-13 21:44:26 UTC (rev 134477)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2012-11-13 21:46:53 UTC (rev 134478)
@@ -64,6 +64,13 @@
     m_rootLayerID = static_cast<RemoteGraphicsLayer*>(rootLayer)->layerID();
 }
 
+void RemoteLayerTreeContext::layerWillBeDestroyed(RemoteGraphicsLayer* graphicsLayer)
+{
+    ASSERT(!m_destroyedLayers.contains(graphicsLayer->layerID()));
+
+    m_destroyedLayers.append(graphicsLayer->layerID());
+}
+
 void RemoteLayerTreeContext::scheduleLayerFlush()
 {
     if (m_layerFlushTimer.isActive())
@@ -95,6 +102,7 @@
 
     RemoteLayerTreeTransaction transaction;
     transaction.setRootLayerID(m_rootLayerID);
+    transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
 
     TemporaryChange<RemoteLayerTreeTransaction*> transactionChange(m_currentTransaction, &transaction);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to