Repository navigation
[embedder] Add FlutterEngineSpawn API for engine group spawning - #52
Draft
xiaowei-guan wants to merge 6 commits into
Draft
xiaowei-guan wants to merge 6 commits into
xiaowei-guan wants to merge 6 commits into
Conversation
Add FlutterSpawnConfig and FlutterEngineSpawn to the public embedder API and proc table. Spawn a running child engine in the parent isolate group while reusing its threads, VM, snapshots, renderer configuration, and platform callbacks. Support custom entrypoints, arguments, routes, and per-spawn user data. Preserve output handles on failure, initialize spawned rendering surfaces, and respect FLUTTER_ENGINE_NO_PROTOTYPES.
Cover default and nested spawning, custom entrypoints, entrypoint arguments, initial routes, callback user data, lifecycle contracts, rendering, shared thread hosts, error paths, and proc-table exposure.
Add regression coverage for Vulkan extension names, extension pointer arrays, and pipeline cache path ownership after the embedder releases the original inputs.
Own Vulkan strings and pointer arrays retained for spawning, respect struct_size when reading the cache path, polish configuration handling, and document that root isolate startup and callbacks may occur before FlutterEngineSpawn returns or populates engine_out.
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
xiaowei-guan
marked this pull request as draft
November 23, 2026 13:03
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5de1a6829e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
xiaowei-guan
force-pushed
the
flutter-3.47.5-engine-group-02
branch
from
November 24, 2026 06:12
5de1a68 to
1b09615
Compare
Add regression coverage for flushing parent and child microtasks through a shared custom UI task runner and for retaining only fields advertised by older renderer configurations.
Flush all engines sharing a custom UI task runner, preserve shared runners during child shutdown, and copy only renderer fields advertised by the active struct_size to support older embedders safely.
xiaowei-guan
force-pushed
the
flutter-3.47.5-engine-group-02
branch
from
November 24, 2026 06:26
1b09615 to
78cb454
Compare
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.
Why spawn engines?
Android and iOS already have engine groups (
FlutterEngineGroup): additionalengines spawned from a running one share its Dart VM, isolate snapshot, and
isolate group heap — far cheaper than independent engines. The C embedder API
has no equivalent, so embedders needing multiple Flutter UIs in one process
must pay full VM + snapshot + thread cost per engine — impractical on
memory-constrained devices like Smart TVs, and too slow for instantly-appearing
UIs.
The shell already implements spawning internally (
Shell::Spawn); it is justnot exposed. This PR adds
FlutterEngineSpawntoembedder.h:is returned already running its Dart entrypoint.
cross-group overhead.
Use cases
several live surfaces — app cards, previews, PiP — each with its own Flutter
UI tree, all sharing one VM. Tizen TV multi-view support is built on this
API (follow-ups:
TizenEngineGroup+ per-view pixel-buffer render targets).splash screens that must appear immediately.
where each cell runs a separate
dart_entrypointwith its own route/args.data exchange.