Repository navigation
Conversation
Adds the native half of a spare page: the module can boot one shell page for a host and generation before any screen asks for it, hand its session id out once, and let the next view rendered with that id adopt the page instead of building one. Nothing calls it yet, so behaviour is unchanged. - prepareSpare / takeSpare / discardSpares on the module, and a replayPageReady view function. JS sees them through OrcaMobileWebShellSpares, which is null on binaries without them. - One spare app-wide. Every fence is installed by the same page code at boot. A session id is loaded by one WebView ever: a taken spare leaves the pool before its id is returned, and an issued id whose page is gone makes the view report render-process-gone, so the session remounts with a fresh id. - Adoption replays what the parked page reported (load states and its last ready), so the session sees the same sequence as a fresh view and does not wait out the page's 2 s ready backoff. - Teardown: memory pressure, app backgrounded, activity or module destroyed, a claimed spare not adopted within 10 s, and a dead renderer. - Android parks the WebView detached, laid out at the window size. iOS parks it in the key window beneath the app with touches and accessibility off: off-window WebKit defers its GPU process to the first shown view, which stalled a first open by ~1.8 s on the simulator. - The slot rules are pure and checked on both platforms. Co-Authored-By: Claude <[email protected]>
# Conflicts: # mobile/modules/orca-mobile-web-shell/ios/MobileWebShellPage.swift
…euses an id on screen
# Conflicts: # mobile/modules/orca-mobile-web-shell/android/src/main/java/expo/modules/orcamobilewebshell/MobileWebShellPage.kt # mobile/modules/orca-mobile-web-shell/ios/MobileWebShellPage.swift
This was referenced Nov 8, 2026
AmoabaKelvin
added a commit
that referenced
this pull request
Nov 9, 2026
While native Home is on screen, boot one page document for the most recently connected host with a cached build, parked invisibly in the window. Opening a page from that build adopts it instead of building a WebView, which removes the WebView start and script parse from the tap. The spare is dropped when Home is left without a claim (2 s grace), on background, memory pressure, its own failure and before the cache deletes its files. It is never kept beside a shown page, and only phones with more than 3 GiB of RAM (4 GB phones) get one. A parked page is told to stop asking for init; the adopting view answers the ready it sent. Builds on Jinwoo's spare pool and replay work in #32203 and #32204. Co-authored-by: Jinwoo-H <[email protected]>
AmoabaKelvin
added a commit
that referenced
this pull request
Nov 9, 2026
…skips the WebView start (#40018) * perf(mobile): answer a page's ready that arrived before its bridge host A page's ready can reach the shell before the screen has built its bridge host (the host waits on the client and the host profile read). It used to be dropped, so init waited for the page's next retry, up to 2 s later. Keep the latest ready per session and answer it once the host exists. * perf(mobile): keep one prewarmed page document while Home is shown While native Home is on screen, boot one page document for the most recently connected host with a cached build, parked invisibly in the window. Opening a page from that build adopts it instead of building a WebView, which removes the WebView start and script parse from the tap. The spare is dropped when Home is left without a claim (2 s grace), on background, memory pressure, its own failure and before the cache deletes its files. It is never kept beside a shown page, and only phones with more than 3 GiB of RAM (4 GB phones) get one. A parked page is told to stop asking for init; the adopting view answers the ready it sent. Builds on Jinwoo's spare pool and replay work in #32203 and #32204. Co-authored-by: Jinwoo-H <[email protected]> * fix(mobile): unregister the shell's memory callbacks from the context that registered them --------- Co-authored-by: Jinwoo-H <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a native pool that can hold one shell page booted ahead of its screen. Nothing calls it yet (the JS that does is the next PR), so this PR is inert.
prepareSpare(hostKey, directory, sessionId)boots a page under a session id and parks it. There is one spare app-wide; a new prepare replaces it.takeSpare(hostKey, directory)hands its session id to a screen that is about to open. The view that receives that id adopts the page instead of creating one. An unadopted claim is destroyed after 10 s.replayPageReady) until JS first posts to the page, so the JS bridge sees the same sequence as a fresh page.onTrimMemoryat RUNNING_LOW or worse, iOS memory warning), app background, activity or module destroy, renderer death, anddiscardSpares(hostKey?). Discarding a host destroys its parked and claimed spares; a view about to adopt a destroyed claim takes the remount path above. Teardown always runs on the main thread (Android's moduleOnDestroycan run off it, so it posts).MobileWebShellSpareSlots), with Kotlin unit tests and Swift checks for park, take, adopt, expire, reuse refusal and discard.OrcaMobileWebShellSparesis the optional native module, or null on binaries without it.Checks
Kotlin unit tests (
MobileWebShellSpareSlotsTest) and Swift checks (tests/MobileWebShellChecks.swift) pass. Release builds, device-check flows on the Android emulator (API 36) and the iOS 26.5 and 18.1 simulators: first open, host to session, New Workspace overlay, pop to an existing screen (#32110), renderer kill then remount, background then foreground, new page generation from a desktop update, host removal and re-pair.Compat
Additive native functions. JS feature-detects the module, so new JS on older binaries does nothing new. No change to props, events, bridge protocol or the page bundle.