Commit 7fb6646c authored by Devon Carew's avatar Devon Carew Committed by GitHub

fix an issue with reloading when paused at a breakpoint (#9733)

* fix an issues with reloading when paused at a breakpoint

* update docs
parent 7f9d859e
......@@ -304,8 +304,11 @@ class HotRunner extends ResidentRunner {
}
Future<OperationResult> _restartFromSources() async {
printTrace('Refreshing active FlutterViews before restarting.');
await refreshViews();
if (!_isPaused()) {
printTrace('Refreshing active FlutterViews before restarting.');
await refreshViews();
}
final Stopwatch restartTimer = new Stopwatch();
restartTimer.start();
final bool updatedDevFS = await _updateDevFS();
......@@ -401,14 +404,18 @@ class HotRunner extends ResidentRunner {
}
Future<OperationResult> _reloadSources({ bool pause: false }) async {
printTrace('Refreshing active FlutterViews before reloading.');
await refreshViews();
for (FlutterDevice device in flutterDevices) {
for (FlutterView view in device.views) {
if (view.uiIsolate == null)
throw 'Application isolate not found';
}
}
if (!_isPaused()) {
printStatus('Refreshing active FlutterViews before reloading.');
await refreshViews();
}
// The initial launch is from a script snapshot. When we reload from source
// on top of a script snapshot, the first reload will be a worst case reload
// because all of the sources will end up being dirty (library paths will
......@@ -563,6 +570,21 @@ class HotRunner extends ResidentRunner {
);
}
bool _isPaused() {
for (FlutterDevice device in flutterDevices) {
for (FlutterView view in device.views) {
if (view.uiIsolate != null) {
final ServiceEvent pauseEvent = view.uiIsolate.pauseEvent;
if (pauseEvent != null && pauseEvent.isPauseEvent) {
return true;
}
}
}
}
return false;
}
@override
void printHelp({ @required bool details }) {
const String fire = '🔥';
......
......@@ -844,6 +844,9 @@ class Isolate extends ServiceObjectOwner {
Isolate get isolate => this;
DateTime startTime;
/// The last pause event delivered to the isolate. If the isolate is running,
/// this will be a resume event.
ServiceEvent pauseEvent;
final Map<String, ServiceObject> _cache = <String, ServiceObject>{};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment