Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: runtime/bin/vmservice/vmservice_io.dart

Issue 1030013002: Shutdown the service isolate when shutting down the VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/vmservice_io.dart
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 2d99e17eb85787fab4fe322e4732688083870545..070a25c3dc62aa963153abcd6f9e864a5bfdab2d 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -23,25 +23,37 @@ bool _autoStart;
bool _isWindows = false;
var _signalWatch;
+var _signalSubscription;
// HTTP servr.
Server server;
Future<Server> serverFuture;
-void _bootServer() {
+_onShutdown() {
+ if (server != null) {
+ server.close(true).catchError((e, st) => assert(e));
kasperl 2015/03/27 07:50:55 This is illegal syntax (assert isn't an expression
+ }
+ if (_signalSubscription != null) {
+ _signalSubscription.cancel();
+ _signalSubscription = null;
+ }
+}
+
+_bootServer() {
// Load resources.
_triggerResourceLoad();
// Lazily create service.
var service = new VMService();
+ service.onShutdown = _onShutdown;
// Lazily create server.
server = new Server(service, _ip, _port);
}
-void _clearFuture(_) {
+_clearFuture(_) {
serverFuture = null;
}
-void _onSignal(ProcessSignal signal) {
+_onSignal(ProcessSignal signal) {
if (serverFuture != null) {
// Still waiting.
return;
@@ -57,12 +69,12 @@ void _onSignal(ProcessSignal signal) {
}
}
-void _registerSignalHandler() {
+_registerSignalHandler() {
if (_isWindows) {
// Cannot register for signals on Windows.
return;
}
- _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal);
+ _signalSubscription = _signalWatch(ProcessSignal.SIGQUIT).listen(_onSignal);
}
const _shortDelay = const Duration(milliseconds: 10);
« no previous file with comments | « runtime/bin/vmservice/server.dart ('k') | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698