| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library vmservice_io; | 5 library vmservice_io; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; |
| 8 import 'dart:convert'; | 9 import 'dart:convert'; |
| 9 import 'dart:io'; | 10 import 'dart:io'; |
| 10 import 'dart:isolate'; | 11 import 'dart:isolate'; |
| 11 import 'dart:_vmservice'; | 12 import 'dart:_vmservice'; |
| 12 | 13 |
| 13 part 'loader.dart'; | 14 part 'loader.dart'; |
| 14 part 'server.dart'; | 15 part 'server.dart'; |
| 15 | 16 |
| 16 // The TCP ip/port that the HTTP server listens on. | 17 // The TCP ip/port that the HTTP server listens on. |
| 17 int _port; | 18 int _port; |
| 18 String _ip; | 19 String _ip; |
| 19 // Should the HTTP server auto start? | 20 // Should the HTTP server auto start? |
| 20 bool _autoStart; | 21 bool _autoStart; |
| 21 | 22 |
| 22 bool _isWindows = false; | 23 bool _isWindows = false; |
| 23 | 24 |
| 24 var _signalWatch; | 25 var _signalWatch; |
| 25 var _signalSubscription; | 26 var _signalSubscription; |
| 26 | 27 |
| 27 // HTTP server. | 28 // HTTP server. |
| 28 Server server; | 29 Server server; |
| 29 Future<Server> serverFuture; | 30 Future<Server> serverFuture; |
| 30 Map<String, Asset> assets; | 31 HashMap<String, Asset> assets; |
| 31 | 32 |
| 32 _onShutdown() { | 33 _onShutdown() { |
| 33 if (server != null) { | 34 if (server != null) { |
| 34 server.close(true).catchError((e, st) { | 35 server.close(true).catchError((e, st) { |
| 35 print("Error in vm-service shutdown: $e\n$st\n"); | 36 print("Error in vm-service shutdown: $e\n$st\n"); |
| 36 }); | 37 }); |
| 37 } | 38 } |
| 38 if (_signalSubscription != null) { | 39 if (_signalSubscription != null) { |
| 39 _signalSubscription.cancel(); | 40 _signalSubscription.cancel(); |
| 40 _signalSubscription = null; | 41 _signalSubscription = null; |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // else { | 101 // else { |
| 101 // var service = new VMService(); | 102 // var service = new VMService(); |
| 102 // service.onShutdown = _onShutdown; | 103 // service.onShutdown = _onShutdown; |
| 103 // } | 104 // } |
| 104 scriptLoadPort.handler = _processLoadRequest; | 105 scriptLoadPort.handler = _processLoadRequest; |
| 105 // Register signal handler after a small delay to avoid stalling main | 106 // Register signal handler after a small delay to avoid stalling main |
| 106 // isolate startup. | 107 // isolate startup. |
| 107 new Timer(_shortDelay, _registerSignalHandler); | 108 new Timer(_shortDelay, _registerSignalHandler); |
| 108 return scriptLoadPort; | 109 return scriptLoadPort; |
| 109 } | 110 } |
| OLD | NEW |