Fix hot restart when application is being debugged (#9450)

- [x] Resume the isolate before performing a hot restart.

Fixes #8923
This commit is contained in:
John McCutchan 2017-04-18 13:27:53 -07:00 committed by GitHub
parent 4906297c28
commit 2cf50ce574
2 changed files with 18 additions and 0 deletions

View File

@ -329,6 +329,18 @@ class HotRunner extends ResidentRunner {
final bool updatedDevFS = await _updateDevFS();
if (!updatedDevFS)
return new OperationResult(1, 'DevFS Synchronization Failed');
// Check if the isolate is paused and resume it.
if (currentView?.uiIsolate != null) {
// Reload the isolate.
await currentView.uiIsolate.reload();
final ServiceEvent pauseEvent = currentView.uiIsolate.pauseEvent;
if ((pauseEvent != null) && pauseEvent.isPauseEvent) {
// Resume the isolate so that it can be killed by the embedder.
await currentView.uiIsolate.resume();
}
}
// We are now running from source.
_runningFromSnapshot = false;
await _launchFromDevFS(package, mainPath);
restartTimer.stop();
printTrace('Restart performed in '

View File

@ -941,6 +941,12 @@ class Isolate extends ServiceObjectOwner {
}
}
/// Resumes the isolate.
Future<Map<String, dynamic>> resume() {
return invokeRpcRaw('resume');
}
// Flutter extension methods.
// Invoke a flutter extension method, if the flutter extension is not