Skip to content

Commit

Permalink
REGRESSION(264617@main): fast/forms/ios/file-upload-panel-accept.html…
Browse files Browse the repository at this point in the history
… is a constant timeout

https://bugs.webkit.org/show_bug.cgi?id=258901
rdar://110879270

Reviewed by Simon Fraser.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
The explicit commit introduced in 264617@main caused multiple bits of unexpected
fallout, breaking a layout test and bypassing commit-coalescing optimizations
in UIKit.

Instead of explicitly committing, just hold on to the IOSurface ports until
the commit arrives in the render server. (We can't hold on to the whole
transaction because the ports are consumed when applying the backing store
to its layer).

Canonical link: https://commits.webkit.org/265825@main
  • Loading branch information
hortont424 committed Jul 6, 2023
1 parent 35ebce2 commit 6caf4c7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ typedef enum {
kCATransactionPhasePreLayout,
kCATransactionPhasePreCommit,
kCATransactionPhasePostCommit,
kCATransactionPhasePostSynchronize = 5,
kCATransactionPhaseNull = ~0u
} CATransactionPhase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,25 @@

void RemoteLayerTreeDrawingAreaProxy::commitLayerTree(IPC::Connection& connection, const Vector<std::pair<RemoteLayerTreeTransaction, RemoteScrollingCoordinatorTransaction>>& transactions)
{
[CATransaction begin];
for (auto& transaction : transactions)
Vector<MachSendRight> sendRights;
for (auto& transaction : transactions) {
// commitLayerTreeTransaction consumes the incoming buffers, so we need to grab them first.
for (auto& [layerID, properties] : transaction.first.changedLayerProperties()) {
const auto backingStoreProperties = properties->backingStoreProperties.get();
if (!backingStoreProperties)
continue;
if (const auto& backendHandle = backingStoreProperties->bufferHandle()) {
if (const auto* sendRight = std::get_if<MachSendRight>(&backendHandle.value()))
sendRights.append(*sendRight);
}
}

commitLayerTreeTransaction(connection, transaction.first, transaction.second);
[CATransaction commit];
}

// Keep IOSurface send rights alive until the commit makes it to the render server, otherwise we will
// prematurely drop the only reference to them, and `inUse` will be wrong for a brief window.
[CATransaction addCommitHandler:[sendRights = WTFMove(sendRights)]() { } forPhase:kCATransactionPhasePostSynchronize];
}

void RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction(IPC::Connection& connection, const RemoteLayerTreeTransaction& layerTreeTransaction, const RemoteScrollingCoordinatorTransaction& scrollingTreeTransaction)
Expand Down

0 comments on commit 6caf4c7

Please sign in to comment.