Commit 91128238 authored by John McCutchan's avatar John McCutchan Committed by GitHub

Do not reassemble the application after a hot reload if the isolate is paused (#6370)

parent c0742652
...@@ -493,6 +493,15 @@ class HotRunner extends ResidentRunner { ...@@ -493,6 +493,15 @@ class HotRunner extends ResidentRunner {
printError('Hot reload failed:\ncode = $errorCode\nmessage = $errorMessage\n$st'); printError('Hot reload failed:\ncode = $errorCode\nmessage = $errorMessage\n$st');
return false; return false;
} }
// Reload the isolate.
await currentView.uiIsolate.reload();
// Check if the isolate is paused.
final ServiceEvent pauseEvent = currentView.uiIsolate.pauseEvent;
if ((pauseEvent != null) && (pauseEvent.isPauseEvent)) {
// Isolate is paused. Stop here.
printTrace('Skipping reassemble because isolate is paused.');
return true;
}
await _evictDirtyAssets(); await _evictDirtyAssets();
printTrace('Reassembling application'); printTrace('Reassembling application');
bool waitForFrame = true; bool waitForFrame = true;
...@@ -510,7 +519,7 @@ class HotRunner extends ResidentRunner { ...@@ -510,7 +519,7 @@ class HotRunner extends ResidentRunner {
} }
if (waitForFrame) { if (waitForFrame) {
// When the framework is present, we can wait for the first frame // When the framework is present, we can wait for the first frame
// event and measure reload itme. // event and measure reload time.
await firstFrameTimer.firstFrame(); await firstFrameTimer.firstFrame();
printStatus('Hot reload performed in ' printStatus('Hot reload performed in '
'${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}.'); '${getElapsedAsMilliseconds(firstFrameTimer.elapsed)}.');
......
...@@ -332,6 +332,7 @@ class ServiceEvent extends ServiceObject { ...@@ -332,6 +332,7 @@ class ServiceEvent extends ServiceObject {
static const String kPauseBreakpoint = 'PauseBreakpoint'; static const String kPauseBreakpoint = 'PauseBreakpoint';
static const String kPauseInterrupted = 'PauseInterrupted'; static const String kPauseInterrupted = 'PauseInterrupted';
static const String kPauseException = 'PauseException'; static const String kPauseException = 'PauseException';
static const String kPausePostRequest = 'PausePostRequest';
static const String kNone = 'None'; static const String kNone = 'None';
static const String kResume = 'Resume'; static const String kResume = 'Resume';
static const String kBreakpointAdded = 'BreakpointAdded'; static const String kBreakpointAdded = 'BreakpointAdded';
...@@ -379,6 +380,7 @@ class ServiceEvent extends ServiceObject { ...@@ -379,6 +380,7 @@ class ServiceEvent extends ServiceObject {
kind == kPauseBreakpoint || kind == kPauseBreakpoint ||
kind == kPauseInterrupted || kind == kPauseInterrupted ||
kind == kPauseException || kind == kPauseException ||
kind == kPausePostRequest ||
kind == kNone); kind == kNone);
} }
} }
...@@ -680,6 +682,7 @@ class Isolate extends ServiceObjectOwner { ...@@ -680,6 +682,7 @@ class Isolate extends ServiceObjectOwner {
Isolate get isolate => this; Isolate get isolate => this;
DateTime startTime; DateTime startTime;
ServiceEvent pauseEvent;
final Map<String, ServiceObject> _cache = new Map<String, ServiceObject>(); final Map<String, ServiceObject> _cache = new Map<String, ServiceObject>();
...@@ -744,8 +747,9 @@ class Isolate extends ServiceObjectOwner { ...@@ -744,8 +747,9 @@ class Isolate extends ServiceObjectOwner {
int startTimeMillis = map['startTime']; int startTimeMillis = map['startTime'];
startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeMillis); startTime = new DateTime.fromMillisecondsSinceEpoch(startTimeMillis);
// TODO(johnmccutchan): Extract any properties we care about here.
_upgradeCollection(map, this); _upgradeCollection(map, this);
pauseEvent = map['pauseEvent'];
} }
static final int kIsolateReloadBarred = 1005; static final int kIsolateReloadBarred = 1005;
......
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