Title: [179630] trunk/Source/WebKit2
Revision
179630
Author
simon.fra...@apple.com
Date
2015-02-04 14:04:52 -0800 (Wed, 04 Feb 2015)

Log Message

[iOS WK2] Layers that are created and destroyed in the same transaction shouldn't be encoded
https://bugs.webkit.org/show_bug.cgi?id=141228

Reviewed by Tim Horton.

With UI-side compositing, it was possible for layers to get created and
destroyed in the same transaction (e.g. two layouts before a single layer
tree commit). When that happened we would encode layer creation properties
but not encode layer properties, since the layer would be unreachable.

Fix by removing deleted layers from the created layers list, which is
converted into a map for easy searching.

* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::layerWasCreated):
(WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
(WebKit::RemoteLayerTreeContext::buildTransaction):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179629 => 179630)


--- trunk/Source/WebKit2/ChangeLog	2015-02-04 22:04:41 UTC (rev 179629)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-04 22:04:52 UTC (rev 179630)
@@ -1,3 +1,24 @@
+2015-02-04  Simon Fraser  <simon.fra...@apple.com>
+
+        [iOS WK2] Layers that are created and destroyed in the same transaction shouldn't be encoded
+        https://bugs.webkit.org/show_bug.cgi?id=141228
+
+        Reviewed by Tim Horton.
+        
+        With UI-side compositing, it was possible for layers to get created and
+        destroyed in the same transaction (e.g. two layouts before a single layer
+        tree commit). When that happened we would encode layer creation properties
+        but not encode layer properties, since the layer would be unreachable.
+        
+        Fix by removing deleted layers from the created layers list, which is
+        converted into a map for easy searching.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::layerWasCreated):
+        (WebKit::RemoteLayerTreeContext::layerWillBeDestroyed):
+        (WebKit::RemoteLayerTreeContext::buildTransaction):
+
 2015-02-04  Michael Catanzaro  <mcatanz...@igalia.com>
 
         Build with seccomp filters broken since r179409

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2015-02-04 22:04:41 UTC (rev 179629)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h	2015-02-04 22:04:52 UTC (rev 179630)
@@ -77,7 +77,7 @@
 
     WebPage& m_webPage;
 
-    Vector<RemoteLayerTreeTransaction::LayerCreationProperties> m_createdLayers;
+    HashMap<WebCore::GraphicsLayer::PlatformLayerID, RemoteLayerTreeTransaction::LayerCreationProperties> m_createdLayers;
     Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
 
     HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_liveLayers;

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


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2015-02-04 22:04:41 UTC (rev 179629)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm	2015-02-04 22:04:52 UTC (rev 179630)
@@ -66,7 +66,7 @@
         creationProperties.hostingDeviceScaleFactor = deviceScaleFactor();
     }
 
-    m_createdLayers.append(creationProperties);
+    m_createdLayers.add(layerID, WTF::move(creationProperties));
     m_liveLayers.add(layerID, &layer);
 }
 
@@ -75,6 +75,7 @@
     ASSERT(layer.layerID());
     GraphicsLayer::PlatformLayerID layerID = layer.layerID();
 
+    m_createdLayers.remove(layerID);
     m_liveLayers.remove(layerID);
 
     ASSERT(!m_destroyedLayers.contains(layerID));
@@ -112,8 +113,12 @@
     rootLayerRemote.recursiveBuildTransaction(*this, transaction);
     m_currentTransaction = nullptr;
 
-    transaction.setCreatedLayers(WTF::move(m_createdLayers));
+    Vector<RemoteLayerTreeTransaction::LayerCreationProperties> createdLayerProperties;
+    copyValuesToVector(m_createdLayers, createdLayerProperties);
+    transaction.setCreatedLayers(WTF::move(createdLayerProperties));
     transaction.setDestroyedLayerIDs(WTF::move(m_destroyedLayers));
+    
+    m_createdLayers.clear();
 }
 
 void RemoteLayerTreeContext::layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote& layer)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to