-
Notifications
You must be signed in to change notification settings - Fork 82
Wait for a resume
event to run the main()
method after a page refresh
#2431
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,18 +99,18 @@ class ChromeProxyService implements VmServiceInterface { | |
/// This value can be updated at runtime via [setFlag]. | ||
bool get pauseIsolatesOnStart => _pauseIsolatesOnStart; | ||
|
||
final _resumeAfterHotRestartEventsController = | ||
final _resumeAfterRestartEventsController = | ||
StreamController<String>.broadcast(); | ||
|
||
/// A global stream of resume events. | ||
/// | ||
/// The values in the stream are the isolates IDs for the resume event. | ||
/// | ||
/// IMPORTANT: This should only be listened to during a hot-restart. The | ||
/// debugger ignores any resume events as long as there is a subscriber to | ||
/// this stream. | ||
Stream<String> get resumeAfterHotRestartEventsStream => | ||
_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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, exactly - the stream is listened to only for the duration of the page refresh |
||
Stream<String> get resumeAfterRestartEventsStream => | ||
_resumeAfterRestartEventsController.stream; | ||
|
||
final _logger = Logger('ChromeProxyService'); | ||
|
||
|
@@ -1147,8 +1147,8 @@ ${globalToolConfiguration.loadStrategy.loadModuleSnippet}("dart_sdk").developer. | |
}) async { | ||
// If there is a subscriber listening for a resume event after hot-restart, | ||
// then add the event to the stream and skip processing it. | ||
if (_resumeAfterHotRestartEventsController.hasListener) { | ||
_resumeAfterHotRestartEventsController.add(isolateId); | ||
if (_resumeAfterRestartEventsController.hasListener) { | ||
_resumeAfterRestartEventsController.add(isolateId); | ||
return Success(); | ||
} | ||
if (inspector.appConnection.isStarted) { | ||
|
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.
Are there specific configurations where we want this or is this just a backwards compatible fallback to what we did previously?
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.
This is just backwards compatible fallback - all debugging clients should be setting the pauseIsolatesOnStart flag