-
Notifications
You must be signed in to change notification settings - Fork 28.7k
Started handling messages from background isolates. #109005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
563a5e3
to
8cce92e
Compare
a18df55
to
7c5cc9a
Compare
The overall idea seems fine. I'm not sure I understand the specifics of the implementation on the Dart side. Maybe we can go over the PR together on VC? |
@gaaclarke here's a proposed reworking of the API as discussed in our chat: It's semantically equivalent to the original code, just presented differently. |
f516ee3
to
c7dbcde
Compare
Thanks, I've incorporated most of it now to see how it worked out. I still need to clean it up and incorporate your docs. I made 2 changes:
|
ui.PlatformDispatcher.instance.registerBackgroundIsolate(token); | ||
final BackgroundIsolateBinaryMessenger portBinaryMessenger = BackgroundIsolateBinaryMessenger(); | ||
_backgroundIsolateBinaryMessenger = portBinaryMessenger; | ||
portBinaryMessenger.receivePort.listen((dynamic message) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would advise using the pattern i had on my branch to make this a static method rather than a closure. That'll avoid accidentally closing over things we don't want to close over, but also generally the code will be easier to reason about (and it makes the satisfying pattern of having both the send and the receive logic be parallel).
This comment was marked as resolved.
This comment was marked as resolved.
False positive, there are integration tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Over the course of responding to feedback I broke the integration test which apparently doesn't run as a presubmit. Reverting to open the tree. |
companion engine pr: flutter/engine#35174
design doc: https://docs.google.com/document/d/1yAFw-6kBefuurXWTur9jdEUAckWiWJVukP1Iay8ehyU/edit#
issue: #13937
example
main.dart
AppDelegate.swift
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.