perf(mobile): warm WebKit's processes on iOS before the first page opens (#39851)

* perf(mobile): warm WebKit's processes on iOS before the first page opens

Builds a blank, non-persistent WKWebView a second after Home has a paired
host, so the first page open starts against WebContent, GPU and Network
processes already running. A release before the delayed start now makes
the start a no-op.

Based on #32163 by Jinwoo-H.

Co-authored-by: Jinwoo-H <73622457+Jinwoo-H@users.noreply.github.com>

* fix(mobile): guard warmUp on older binaries and release the warm view on page failure

Co-authored-by: Jinwoo-H <73622457+Jinwoo-H@users.noreply.github.com>

---------

Co-authored-by: m4air <m4air@m4airs-MacBook-Air.local>
Co-authored-by: Jinwoo-H <73622457+Jinwoo-H@users.noreply.github.com>
This commit is contained in:
OrcaWin
2026-11-08 05:01:36 -08:00
committed by GitHub
co-authored by Jinwoo-H m4air
parent 346dcae485
commit 537d764f58
5 changed files with 79 additions and 2 deletions
@@ -7,6 +7,14 @@ public class OrcaMobileWebShellModule: Module {
public func definition() -> ModuleDefinition {
Name("OrcaMobileWebShell")
// Home calls this once it has a paired host, so a user with nothing to open pays nothing.
Function("warmUp") {
// A second's delay keeps the warm-up off the launch's first frames.
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
MobileWebShellWarmUp.start()
}
}
AsyncFunction("presentPdf") { (url: URL) in
guard let presenter = self.appContext?.utilities?.currentViewController() else {
throw PdfPresenterUnavailableException()