mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This is a prototype of the [PlatformIsolate API](https://github.com/flutter/flutter/issues/136314). **UPDATE (Jan 25):** The PR is ready for review. PTAL. The `PlatformIsolate` creation flow is: 1. `PlatformIsolate.spawn` running on parent isolate (platform_isolate.dart) a. Create `isolateReadyPort` b. `PlatformIsolateNativeApi::Spawn` (platform_isolate.cc) c. `DartIsolate::CreatePlatformIsolate` (dart_isolate.cc) d. Isolate created. Entry point invocation task dispatched to platform thread e. `PlatformIsolate.spawn` returns a `Future<Isolate>` 2. On the platform thread, `_platformIsolateMain` is invoked in the platform isolate a. Create `entryPointPort` b. Send `Isolate.current` metadata and `entryPointPort` back to the parent isolate via `isolateReadyPort` 3. Back in the parent isolate, `isolateReadyPort.handler` is invoked a. Send the user's `entryPoint` and `message` to the platform isolate via `entryPointPort` b. Use received isolate metadata to create a new `Isolate` representing the platform isolate and complete the `Future<Isolate>` 4. In the platform isolate, `entryPointPort.handler` is invoked a. Run the user's `entryPoint(message)` The engine shutdown flow is handled by `PlatformIsolateManager`, which maintains a set of running platform isolates.
Flutter Common
The bottom of the dependency graph for Flutter. Useful for static constants. Please don't put too much in here.