[webkit-changes] [WebKit/WebKit] f4ce57: hideContentUntilPendingUpdate async IPC call durin...

bnham noreply at github.com
Tue Feb 6 10:51:39 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f4ce57789de592b5e4d90714e8d0e7c52e01dfa9
      https://github.com/WebKit/WebKit/commit/f4ce57789de592b5e4d90714e8d0e7c52e01dfa9
  Author: Ben Nham <nham at apple.com>
  Date:   2024-02-06 (Tue, 06 Feb 2024)

  Changed paths:
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm

  Log Message:
  -----------
  hideContentUntilPendingUpdate async IPC call during backgrounding blocks process suspension
https://bugs.webkit.org/show_bug.cgi?id=268799
rdar://121185956

Reviewed by Chris Dumez.

On iOS, when the UIProcess goes into the background, it eventually calls in to
hideContentUntilPendingUpdate through this call stack:

```
WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate()
WebKit::WebPageProxy::applicationDidFinishSnapshottingAfterEnteringBackground()
WebKit::ApplicationStateTracker::didCompleteSnapshotSequence()
```

The problem is that we recently added an async `DrawingArea::DispatchAfterEnsuringDrawing` IPC with
reply handler call to hideContentUntilPendingUpdate (see 269776 at main, 270672 at main, 271260 at main). An
async IPC with a reply handler in the UIProcess implicitly takes out a background activity which
prevents the WebContent process (and also the UIProcess) from suspending until the reply handler
runs. Unfortunately, since the WebContent process is in the background, presumably it doesn't
render, so the DispatchAfterEnsuringDrawing reply handler doesn't run, and the background activity
also never completes. We basically end up blocking process suspension entirely until the 15 second
timer in ProcessStateMonitor expires and forcefully invalidates all background activities for all
processes.

We need to fix this by reworking the logic somehow or by making this DispatchAfterEnsuringDrawing
IPC not create a background activity. Here I'm just trying to make the IPC call not start a
background activity.

Note that there's also a DispatchAfterEnsuringDrawing call in WebPageProxy that I didn't touch since
I don't have evidence that it's causing a background power regression, but I wonder if that also
should avoid creating a background activity.

* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::hideContentUntilPendingUpdate):

Canonical link: https://commits.webkit.org/274157@main




More information about the webkit-changes mailing list