Skip to content

Support breakpoints for hot reload #2627

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

Open
wants to merge 36 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
6bbc231
Defer execution of main until resume for hot restart with DDC library…
srujzs Apr 21, 2025
6c57477
Add changelog entry
srujzs May 23, 2025
86799f1
Create file in addLibraryFile
srujzs May 23, 2025
a4b9ff9
Recursively create library folder if it doesn't exist yet
srujzs May 23, 2025
6759806
Address review comments
srujzs May 27, 2025
473eb87
Address review comments about removed breakpoints and move expectatio…
srujzs May 30, 2025
aa54169
Register future waiting for breakpoint before we come across it
srujzs May 31, 2025
f60c2c4
Support breakpoints for hot reload
srujzs May 22, 2025
9167e95
Add issue for optimizing metadata invalidation
srujzs May 29, 2025
32a5809
Expect logs in the future instead and remove now dead code around rem…
srujzs May 30, 2025
7a365a6
Remove duplicate cancel and send real isolateid to reloadsources
srujzs May 31, 2025
b9709a6
Use breakpoint futures instead to wait for breakpoint in the future
srujzs May 31, 2025
a18a7c7
Await main in hot restart tests to fix some race conditions
srujzs Jun 8, 2025
3d61342
Use expectLater instead
srujzs Jun 8, 2025
3fea5a5
Fix e2e 'evaluate' test to use new Closure toString format. (#2624)
biggs0125 May 27, 2025
4b04ad9
Fix e2e_test to work with current DDC output (#2626)
nshahan Jun 3, 2025
ecc3c7a
Update e2e_test expectation to look for more consistent message. (#2630)
biggs0125 Jun 5, 2025
c55980f
Bump the github-actions group across 1 directory with 3 updates (#2593)
dependabot[bot] Jun 5, 2025
13821dd
[dwds] DRY up MD5/etag logic (#2625)
kevmoo Jun 5, 2025
9d3aefc
Remove skip from chrome proxy service test
nshahan Jun 6, 2025
938d4ce
Merge remote-tracking branch 'upstream/main' into hotreloadbreakpoints
srujzs Jun 9, 2025
fbae28c
Use function that returns a Future instead of a stream + completer
srujzs Jun 9, 2025
83a6a5d
Add print logs for failing test
srujzs Jun 9, 2025
3b6e05f
Revert "Add print logs for failing test"
srujzs Jun 10, 2025
2641547
Move reinitialization
srujzs Jun 10, 2025
0733fa0
Remove extraneous use of console logs and add changelog
srujzs Jun 10, 2025
b492d9f
Address review comments
srujzs Jun 12, 2025
fa4ca71
Use Future.wait and increase timeout
srujzs Jun 12, 2025
4c2fce8
Copy fixtures when edits are needed
srujzs Jun 16, 2025
3fe8045
Merge remote-tracking branch 'upstream/main' into hotreloadbreakpoints
srujzs Jun 18, 2025
e376078
Fix missing return and use onDebugEvent
srujzs Jun 18, 2025
9f3d730
Use pubspec_parse to copy dependencies instead of relying on the proj…
srujzs Jun 19, 2025
184bbd3
Fix issue with not normalizing path of dependency before compare and …
srujzs Jun 19, 2025
5ec1261
Wait an extra second if we can't delete the directory yet
srujzs Jun 20, 2025
9cece73
Add await
srujzs Jun 20, 2025
8592053
Copy for all projects, not just those marked editable
srujzs Jun 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dwds/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- Added WebSocket-based hot reload support: `reloadSources` in `ChromeProxyService` and `DevHandler` now handle hot reload requests and responses over WebSockets.
- Refactored the injected client to use a reusable function for handling hot reload requests and responses over WebSockets.
- Added support for breakpoint registering on a hot restart with the DDC library bundle format using PausePostRequests.
- Added support for breakpoint registering on a hot restart and on a hot reload with the DDC library bundle format using PausePostRequests.

## 24.3.10

Expand Down
27 changes: 18 additions & 9 deletions dwds/lib/src/debugging/inspector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
/// Provides information about currently loaded scripts and objects and support
/// for eval.
class AppInspector implements AppInspectorInterface {
final _scriptCacheMemoizer = AsyncMemoizer<List<ScriptRef>>();
var _scriptCacheMemoizer = AsyncMemoizer<List<ScriptRef>>();

Future<List<ScriptRef>> get scriptRefs => _populateScriptCaches();

Expand Down Expand Up @@ -68,9 +68,9 @@ class AppInspector implements AppInspectorInterface {

final ExecutionContext _executionContext;

late final LibraryHelper _libraryHelper;
late final ClassHelper _classHelper;
late final InstanceHelper _instanceHelper;
late LibraryHelper _libraryHelper;
late ClassHelper _classHelper;
late InstanceHelper _instanceHelper;

final AssetReader _assetReader;
final Locations _locations;
Expand Down Expand Up @@ -99,15 +99,25 @@ class AppInspector implements AppInspectorInterface {
this._locations,
this._root,
this._executionContext,
) : _isolateRef = _toIsolateRef(_isolate) {
) : _isolateRef = _toIsolateRef(_isolate);

/// Reset all caches and recompute any mappings.
///
/// Should be called across hot reloads.
Future<void> initialize() async {
_scriptCacheMemoizer = AsyncMemoizer<List<ScriptRef>>();
_scriptRefsById.clear();
_serverPathToScriptRef.clear();
_scriptIdToLibraryId.clear();
_libraryIdToScriptRefs.clear();

_libraryHelper = LibraryHelper(this);
_classHelper = ClassHelper(this);
_instanceHelper = InstanceHelper(this);
}

Future<void> initialize() async {
final libraries = await _libraryHelper.libraryRefs;
isolate.rootLib = await _libraryHelper.rootLib;
isolate.libraries?.clear();
isolate.libraries?.addAll(libraries);

final scripts = await scriptRefs;
Expand Down Expand Up @@ -702,8 +712,7 @@ class AppInspector implements AppInspectorInterface {
/// This populates [_scriptRefsById], [_scriptIdToLibraryId],
/// [_libraryIdToScriptRefs] and [_serverPathToScriptRef].
///
/// It is a one-time operation, because if we do a
/// reload the inspector will get re-created.
/// This will get repopulated on restarts and reloads.
///
/// Returns the list of scripts refs cached.
Future<List<ScriptRef>> _populateScriptCaches() {
Expand Down
Loading
Loading