-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We introduced a `nullFuture` during the null-safety migration where we changed some methods to no longer allow returning `null`, and they therefore had to return a `Future`. That affected timing, because returning `null` was processed synchronously, and that change in timing made some tests fail. Rather that fix the fragile tests, we made the function return a recognizable future, a canonical `Future<Null>.value(null)`, and then recognized it and took a synchronous path for it. That caused other issues, because the future was created in the root zone. (Well, originally, it was created in the first zone which needed one, that was worse. Now it's created in the root zone.) Some code tries to contain asynchrony inside a custom zone, and then the get a `nullFuture` and calls `then` on it, and that schedules a microtask in the root zone. (It should probably have used the listener's zone, and not store a zone in the future at all, but that's how it was first done, and now people rely on that behavior too.) This change creates a `null` future *per zone* (lazily initialized when asked for). That should be sufficient because the code recognizing a returned `null` future is generally running in the same zone, but if any other code gets the `nullFuture`, it will be in the expected zone for where it was requested. This is a reland of commit a247b15 Change-Id: Ia113756de1f6d50af4b1abfec219d6b4dcd5d59b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/249488 Reviewed-by: Nate Bosch <[email protected]> Commit-Queue: Lasse Nielsen <[email protected]>
- Loading branch information
Showing
13 changed files
with
118 additions
and
78 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.