Wait for a resume event to run the main() method after a page refresh - #2431
Merged
Merged
Conversation
nshahan
approved these changes
May 14, 2024
| readyToRunMainCompleter, | ||
| ); | ||
| } else { | ||
| // Otherwise, we can run the app's main() method immediately. |
Contributor
There was a problem hiding this comment.
Are there specific configurations where we want this or is this just a backwards compatible fallback to what we did previously?
Contributor
Author
There was a problem hiding this comment.
This is just backwards compatible fallback - all debugging clients should be setting the pauseIsolatesOnStart flag
| _resumeAfterHotRestartEventsController.stream; | ||
| /// IMPORTANT: This should only be listened to during a hot-restart or page | ||
| /// refresh. The debugger ignores any resume events as long as there is a | ||
| /// subscriber to this stream. |
Contributor
There was a problem hiding this comment.
Does this mean the debugger listens and cancels the listener after for every refresh event? I don't have any problem with that, I'm just asking if I understand this correctly.
Contributor
Author
There was a problem hiding this comment.
Yep, exactly - the stream is listened to only for the duration of the page refresh
copybara-service Bot
pushed a commit
to dart-lang/sdk
that referenced
this pull request
May 16, 2024
Revisions updated by `dart tools/rev_sdk_deps.dart`. async (https://github.com/dart-lang/async/compare/09cba7f..77a25d7): 77a25d7 2024-05-15 Sarah Zakarias Add `topics` to `pubspec.yaml` (dart-archive/async#274) dartdoc (https://github.com/dart-lang/dartdoc/compare/2e706be..476d5cc): 476d5cc8 2024-05-16 Sam Rawlins Refactor PackageGraph._tagReexportsFor and document (dart-lang/dartdoc#3772) 24658cca 2024-05-14 Sam Rawlins Privatize CommentReferenceParser._codeRef (dart-lang/dartdoc#3771) dff86ed9 2024-05-14 Sam Rawlins Bump to 8.0.9 (dart-lang/dartdoc#3770) http (https://github.com/dart-lang/http/compare/4722e03..76deb75): 76deb75 2024-05-16 Hossein Yousefi [cronet_http] Upgrade jni to 0.9.2 and publish 1.2.1 (dart-lang/http#1198) ec55561 2024-05-15 Brian Quinlan [cronet] Use the same host and Android emulator architecture. (dart-lang/http#1201) lints (https://github.com/dart-lang/lints/compare/f0205c1..b254c7e): b254c7e 2024-05-16 Devon Carew Update README.md (dart-archive/lints#189) 5fef508 2024-05-13 Lasse R.H. Nielsen Tighten up the `gen_docs.dart` script. (dart-archive/lints#187) test (https://github.com/dart-lang/test/compare/84d2a2b..2464ad5): 2464ad5c 2024-05-16 Sarah Zakarias Add `topics` to package "test" `pubspec.yaml` (dart-lang/test#2230) 6540a360 2024-05-15 dependabot[bot] Bump the github-actions group across 1 directory with 3 updates (dart-lang/test#2229) 4b6f029c 2024-05-15 dependabot[bot] Bump dart_flutter_team_lints from 2.1.1 to ^3.0.0 in all packages (dart-lang/test#2228) webdev (https://github.com/dart-lang/webdev/compare/d46cf50..fc32eb6): fc32eb69 2024-05-14 Elliott Brooks Collect log message count and log at the end (dart-lang/webdev#2430) 99abc535 2024-05-14 Elliott Brooks Wait for a `resume` event to run the `main()` method after a page refresh (dart-lang/webdev#2431) Change-Id: Iee28bacfc028c92e4b59d95f0c7e61f8282d2968 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366980 Auto-Submit: Devon Carew <devoncarew@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
16 tasks done
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.
I was putting together a doc about the many places we wait for a
resumeevent after either a hot-restart or a page-refresh whenpauseIsolatesOnStartistrue, and realized that I had missed waiting for theresumeevent for page refreshes when running an app withflutter_tools.I then realized that the solution implemented for waiting for a
resumeevent after a page-refresh for internal apps (#2398 and cl/626138927) could be modified to work for bothflutter_toolsand internal apps. These modifications are in this PR.Before this change:
shouldPauseIsolatesOnStartwhich could be called by a client (flutter_tools, DDR) to determine whether or not to immediately call DWDS'runMainmethod after an app connection eventWith this change:
runMainmethod after an app connection eventrunMainwaits for the_readyToRunMainFuture before running the app'smain()method_readyToRunMainFuture is resolved once DWDS receives aresumeeventWork towards flutter/devtools#7231
Requires cl/632610137 to be submitted as well