- Revision
- 272647
- Author
- [email protected]
- Date
- 2021-02-10 06:37:20 -0800 (Wed, 10 Feb 2021)
Log Message
Workaround some order dependent issues by parenting remote layers before applying other properties
https://bugs.webkit.org/show_bug.cgi?id=221585
Reviewed by Simon Fraser.
This runs the updateChildren (renamed to applyHierarchyUpdates for consistency) part of
the RemoteLayerTreePropertyApplier for all the transaction changes prior to running the
rest of applyProperties to work around some downstream bugs that currently require parented
layers to work. This likely won't be required forever, but it should be harmless to do.
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
* Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyProperties):
(WebKit::RemoteLayerTreePropertyApplier::applyHierarchyUpdates):
(WebKit::RemoteLayerTreePropertyApplier::updateChildren): Deleted.
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (272646 => 272647)
--- trunk/Source/WebKit/ChangeLog 2021-02-10 12:43:20 UTC (rev 272646)
+++ trunk/Source/WebKit/ChangeLog 2021-02-10 14:37:20 UTC (rev 272647)
@@ -1,3 +1,23 @@
+2021-02-10 Sam Weinig <[email protected]>
+
+ Workaround some order dependent issues by parenting remote layers before applying other properties
+ https://bugs.webkit.org/show_bug.cgi?id=221585
+
+ Reviewed by Simon Fraser.
+
+ This runs the updateChildren (renamed to applyHierarchyUpdates for consistency) part of
+ the RemoteLayerTreePropertyApplier for all the transaction changes prior to running the
+ rest of applyProperties to work around some downstream bugs that currently require parented
+ layers to work. This likely won't be required forever, but it should be harmless to do.
+
+ * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h:
+ * Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
+ (WebKit::RemoteLayerTreePropertyApplier::applyProperties):
+ (WebKit::RemoteLayerTreePropertyApplier::applyHierarchyUpdates):
+ (WebKit::RemoteLayerTreePropertyApplier::updateChildren): Deleted.
+ * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
+ (WebKit::RemoteLayerTreeHost::updateLayerTree):
+
2021-02-10 Kimmo Kinnunen <[email protected]>
RemoteGraphicsContextGLProxy should support losing the context and should lose the context on timeouts
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h (272646 => 272647)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h 2021-02-10 12:43:20 UTC (rev 272646)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.h 2021-02-10 14:37:20 UTC (rev 272647)
@@ -36,11 +36,12 @@
class RemoteLayerTreePropertyApplier {
public:
using RelatedLayerMap = HashMap<WebCore::GraphicsLayer::PlatformLayerID, std::unique_ptr<RemoteLayerTreeNode>>;
+
+ static void applyHierarchyUpdates(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
static void applyProperties(RemoteLayerTreeNode&, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&, RemoteLayerBackingStore::LayerContentsType);
static void applyPropertiesToLayer(CALayer *, RemoteLayerTreeHost*, const RemoteLayerTreeTransaction::LayerProperties&, RemoteLayerBackingStore::LayerContentsType);
private:
- static void updateChildren(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
static void updateMask(RemoteLayerTreeNode&, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
#if PLATFORM(IOS_FAMILY)
static void applyPropertiesToUIView(UIView *, const RemoteLayerTreeTransaction::LayerProperties&, const RelatedLayerMap&);
Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm (272646 => 272647)
--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm 2021-02-10 12:43:20 UTC (rev 272646)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm 2021-02-10 14:37:20 UTC (rev 272647)
@@ -279,7 +279,6 @@
BEGIN_BLOCK_OBJC_EXCEPTIONS
applyPropertiesToLayer(node.layer(), layerTreeHost, properties, layerContentsType);
- updateChildren(node, properties, relatedLayers);
updateMask(node, properties, relatedLayers);
if (properties.changedProperties & RemoteLayerTreeTransaction::EventRegionChanged)
@@ -292,8 +291,10 @@
END_BLOCK_OBJC_EXCEPTIONS
}
-void RemoteLayerTreePropertyApplier::updateChildren(RemoteLayerTreeNode& node, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers)
+void RemoteLayerTreePropertyApplier::applyHierarchyUpdates(RemoteLayerTreeNode& node, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers)
{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+
if (!properties.changedProperties.contains(RemoteLayerTreeTransaction::ChildrenChanged))
return;
@@ -341,6 +342,8 @@
#endif
return childNode->layer();
}).get();
+
+ END_BLOCK_OBJC_EXCEPTIONS
}
void RemoteLayerTreePropertyApplier::updateMask(RemoteLayerTreeNode& node, const RemoteLayerTreeTransaction::LayerProperties& properties, const RelatedLayerMap& relatedLayers)
Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (272646 => 272647)
--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm 2021-02-10 12:43:20 UTC (rev 272646)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm 2021-02-10 14:37:20 UTC (rev 272647)
@@ -95,6 +95,21 @@
auto layerContentsType = m_drawingArea->hasDebugIndicator() ? RemoteLayerBackingStore::LayerContentsType::IOSurface : RemoteLayerBackingStore::LayerContentsType::CAMachPort;
#endif
+ for (auto& [layerID, propertiesPointer] : transaction.changedLayerProperties()) {
+ const RemoteLayerTreeTransaction::LayerProperties& properties = *propertiesPointer;
+
+ auto* node = nodeForID(layerID);
+ ASSERT(node);
+
+ if (!node) {
+ // We have evidence that this can still happen, but don't know how (see r241899 for one already-fixed cause).
+ RELEASE_LOG_IF_ALLOWED("%p RemoteLayerTreeHost::updateLayerTree - failed to find layer with ID %llu", this, layerID);
+ continue;
+ }
+
+ RemoteLayerTreePropertyApplier::applyHierarchyUpdates(*node, properties, m_nodes);
+ }
+
for (auto& changedLayer : transaction.changedLayerProperties()) {
auto layerID = changedLayer.key;
const RemoteLayerTreeTransaction::LayerProperties& properties = *changedLayer.value;