Skip to content
Merged
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions dwds/lib/src/debugging/debugger.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ class Debugger extends Domain {

PauseState _pauseState = PauseState.none;

bool _pausedOverlayVisible = false;

String get pauseState => _pauseModePauseStates.entries
.firstWhere((entry) => entry.value == _pauseState)
.key;
Expand Down Expand Up @@ -392,6 +394,25 @@ class Debugger extends Domain {
return await inspector.jsCallFunctionOn(receiver, expression, args);
}

// Renders the paused at breakpoint overlay over the application.
void _showPausedOverlay() async {
if (_pausedOverlayVisible) return;
handleErrorIfPresent(await _remoteDebugger?.sendCommand('DOM.enable'));
handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.enable'));
handleErrorIfPresent(await _remoteDebugger
?.sendCommand('Overlay.setPausedInDebuggerMessage', params: {
'message': 'Paused in Dart DevTools',
}));
_pausedOverlayVisible = true;
}

// Removes the paused at breakpoint overlay from the application.
void _hidePausedOverlay() async {
if (!_pausedOverlayVisible) return;
handleErrorIfPresent(await _remoteDebugger?.sendCommand('Overlay.disable'));
_pausedOverlayVisible = false;
}

/// Calls the Chrome Runtime.getProperties API for the object with [objectId].
///
/// Note that the property names are JS names, e.g.
Expand Down Expand Up @@ -563,6 +584,7 @@ class Debugger extends Domain {
logger.warning('Error calculating Dart frames', e, s);
}

_showPausedOverlay();
isolate.pauseEvent = event;
_streamNotify('Debug', event);
}
Expand All @@ -579,6 +601,8 @@ class Debugger extends Domain {
kind: EventKind.kResume,
timestamp: DateTime.now().millisecondsSinceEpoch,
isolate: inspector.isolateRef);

_hidePausedOverlay();
isolate.pauseEvent = event;
_streamNotify('Debug', event);
}
Expand Down