-
Notifications
You must be signed in to change notification settings - Fork 83
Remove circular dependencies and unused code in preparation for further null safety migration #1664
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
Merged
annagrin
merged 20 commits into
dart-lang:master
from
annagrin:annagrin/null-safety-dwds-domain
Jul 8, 2022
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
813d904
Migrate modules and locations to null safety
66c26e2
Remove circular dependencies
a9f4a28
Remove circular dependencies and unused code
66831f8
Simplified expression evaluation code
5432f4e
Merge branch 'master' of github.com:dart-lang/webdev into annagrin/nu…
c5be8df
Cleanup
e882cdc
Fix failing tests
1b3372e
Move more helpers from Domain to ChromeProxyService
8706db0
Build
a126f48
Merge with master
d0f1890
Fix failing hot reload tests, report hot reload errors from the injec…
12caff4
Updated changelog
20f68a2
Merge branch 'master' of github.com:dart-lang/webdev into annagrin/nu…
1aaeaa6
Update changelog
b3951c8
Merged with master
e38090a
Addressed CR comments
c857390
Merge with master
741093b
Merged with master
f7e5a5a
Merge with master
f23d0bc
Address CR comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart' | |
hide StackTrace; | ||
|
||
import '../loaders/strategy.dart'; | ||
import '../services/chrome_proxy_service.dart'; | ||
import '../services/chrome_debug_exception.dart'; | ||
import '../utilities/conversions.dart'; | ||
import '../utilities/dart_uri.dart'; | ||
|
@@ -28,6 +27,10 @@ import 'location.dart'; | |
import 'remote_debugger.dart'; | ||
import 'skip_list.dart'; | ||
|
||
/// Adds [event] to the stream with [streamId] if there is anybody listening | ||
/// on that stream. | ||
typedef StreamNotify = void Function(String streamId, Event event); | ||
|
||
/// Converts from ExceptionPauseMode strings to [PauseState] enums. | ||
/// | ||
/// Values defined in: | ||
|
@@ -51,16 +54,13 @@ class Debugger extends Domain { | |
Debugger._( | ||
this._remoteDebugger, | ||
this._streamNotify, | ||
AppInspectorProvider provider, | ||
this._locations, | ||
this._skipLists, | ||
this._root, | ||
) : _breakpoints = _Breakpoints( | ||
) : _breakpoints = _Breakpoints( | ||
locations: _locations, | ||
provider: provider, | ||
remoteDebugger: _remoteDebugger, | ||
root: _root), | ||
super(provider); | ||
root: _root); | ||
|
||
/// The breakpoints we have set so far, indexable by either | ||
/// Dart or JS ID. | ||
|
@@ -86,15 +86,19 @@ class Debugger extends Domain { | |
|
||
bool _isStepping = false; | ||
|
||
void updateInspector(AppInspectorInterface appInspector) { | ||
inspector = appInspector; | ||
_breakpoints.inspector = appInspector; | ||
} | ||
|
||
Future<Success> pause() async { | ||
_isStepping = false; | ||
final result = await _remoteDebugger.pause(); | ||
handleErrorIfPresent(result); | ||
return Success(); | ||
} | ||
|
||
Future<Success> setExceptionPauseMode(String isolateId, String mode) async { | ||
checkIsolate('setExceptionPauseMode', isolateId); | ||
Future<Success> setExceptionPauseMode(String mode) async { | ||
mode = mode?.toLowerCase(); | ||
if (!_pauseModePauseStates.containsKey(mode)) { | ||
throwInvalidParam('setExceptionPauseMode', 'Unsupported mode: $mode'); | ||
|
@@ -117,9 +121,7 @@ class Debugger extends Domain { | |
/// | ||
/// Note that stepping will automatically continue until Chrome is paused at | ||
/// a location for which we have source information. | ||
Future<Success> resume(String isolateId, | ||
{String step, int frameIndex}) async { | ||
checkIsolate('resume', isolateId); | ||
Future<Success> resume({String step, int frameIndex}) async { | ||
if (frameIndex != null) { | ||
throw ArgumentError('FrameIndex is currently unsupported.'); | ||
} | ||
|
@@ -152,9 +154,7 @@ class Debugger extends Domain { | |
/// Returns null if the debugger is not paused. | ||
/// | ||
/// The returned stack will contain up to [limit] frames if provided. | ||
Future<Stack> getStack(String isolateId, {int limit}) async { | ||
checkIsolate('getStack', isolateId); | ||
|
||
Future<Stack> getStack({int limit}) async { | ||
if (stackComputer == null) { | ||
throw RPCError('getStack', RPCError.kInternalError, | ||
'Cannot compute stack when application is not paused'); | ||
|
@@ -170,15 +170,13 @@ class Debugger extends Domain { | |
static Future<Debugger> create( | ||
RemoteDebugger remoteDebugger, | ||
StreamNotify streamNotify, | ||
AppInspectorProvider appInspectorProvider, | ||
Locations locations, | ||
SkipLists skipLists, | ||
String root, | ||
) async { | ||
final debugger = Debugger._( | ||
remoteDebugger, | ||
streamNotify, | ||
appInspectorProvider, | ||
locations, | ||
skipLists, | ||
root, | ||
|
@@ -224,13 +222,11 @@ class Debugger extends Domain { | |
/// | ||
/// Note that line and column are Dart source locations and are one-based. | ||
Future<Breakpoint> addBreakpoint( | ||
String isolateId, | ||
String scriptId, | ||
int line, { | ||
int column, | ||
}) async { | ||
column ??= 0; | ||
checkIsolate('addBreakpoint', isolateId); | ||
final breakpoint = await _breakpoints.add(scriptId, line, column); | ||
_notifyBreakpoint(breakpoint); | ||
return breakpoint; | ||
|
@@ -264,9 +260,7 @@ class Debugger extends Domain { | |
// Disabled breakpoints were actually removed from Chrome so simply add | ||
// them back. | ||
for (var breakpoint in disabledBreakpoints) { | ||
await addBreakpoint( | ||
inspector.isolate.id, | ||
(await _updatedScriptRefFor(breakpoint)).id, | ||
await addBreakpoint((await _updatedScriptRefFor(breakpoint)).id, | ||
_lineNumberFor(breakpoint), | ||
column: _columnNumberFor(breakpoint)); | ||
} | ||
|
@@ -283,9 +277,7 @@ class Debugger extends Domain { | |
} | ||
|
||
/// Remove a Dart breakpoint. | ||
Future<Success> removeBreakpoint( | ||
String isolateId, String breakpointId) async { | ||
checkIsolate('removeBreakpoint', isolateId); | ||
Future<Success> removeBreakpoint(String breakpointId) async { | ||
if (!_breakpoints._bpByDartId.containsKey(breakpointId)) { | ||
throwInvalidParam( | ||
'removeBreakpoint', 'invalid breakpoint id $breakpointId'); | ||
|
@@ -361,8 +353,7 @@ class Debugger extends Domain { | |
Future<BoundVariable> _boundVariable(Property property) async { | ||
// We return one level of properties from this object. Sub-properties are | ||
// another round trip. | ||
final instanceRef = | ||
await inspector.instanceHelper.instanceRefFor(property.value); | ||
final instanceRef = await inspector.instanceRefFor(property.value); | ||
// Skip null instance refs, which we get for weird objects, e.g. | ||
// properties that are getter/setter pairs. | ||
// TODO(alanknight): Handle these properly. | ||
|
@@ -552,7 +543,7 @@ class Debugger extends Domain { | |
if (map['type'] == 'object') { | ||
// The className here is generally 'DartError'. | ||
final obj = RemoteObject(map); | ||
exception = await inspector.instanceHelper.instanceRefFor(obj); | ||
exception = await inspector.instanceRefFor(obj); | ||
|
||
// TODO: The exception object generally doesn't get converted to a | ||
// Dart object (and instead has a classRef name of 'NativeJavaScriptObject'). | ||
|
@@ -561,8 +552,7 @@ class Debugger extends Domain { | |
// Create a string exception object. | ||
final description = | ||
await inspector.mapExceptionStackTrace(obj.description); | ||
exception = | ||
await inspector.instanceHelper.instanceRefFor(description); | ||
exception = await inspector.instanceRefFor(description); | ||
} else { | ||
exception = null; | ||
} | ||
|
@@ -671,21 +661,6 @@ class Debugger extends Domain { | |
logger.severe('Target crashed!'); | ||
} | ||
|
||
/// Evaluate [expression] by calling Chrome's Runtime.evaluate | ||
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. Duplicate - we already have this functionality in inspector.dart |
||
Future<RemoteObject> evaluate(String expression) async { | ||
try { | ||
return await _remoteDebugger.evaluate(expression); | ||
} on ExceptionDetails catch (e) { | ||
throw ChromeDebugException( | ||
e.json, | ||
evalContents: expression, | ||
additionalDetails: { | ||
'Dart expression': expression, | ||
}, | ||
); | ||
} | ||
} | ||
|
||
WipCallFrame jsFrameForIndex(int frameIndex) { | ||
if (stackComputer == null) { | ||
throw RPCError('evaluateInFrame', 106, | ||
|
@@ -766,10 +741,9 @@ class _Breakpoints extends Domain { | |
|
||
_Breakpoints({ | ||
@required this.locations, | ||
@required AppInspectorProvider provider, | ||
@required this.remoteDebugger, | ||
@required this.root, | ||
}) : super(provider); | ||
}); | ||
|
||
Future<Breakpoint> _createBreakpoint( | ||
String id, String scriptId, int line, int column) async { | ||
|
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.