| 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; | 5 library vmservice; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 case Constants.ISOLATE_STARTUP_MESSAGE_ID: | 59 case Constants.ISOLATE_STARTUP_MESSAGE_ID: |
| 60 runningIsolates.isolateStartup(portId, sp, name); | 60 runningIsolates.isolateStartup(portId, sp, name); |
| 61 break; | 61 break; |
| 62 case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID: | 62 case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID: |
| 63 runningIsolates.isolateShutdown(portId, sp); | 63 runningIsolates.isolateShutdown(portId, sp); |
| 64 break; | 64 break; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 void _exit() { | 68 void _exit() { |
| 69 if (onShutdown != null) { | |
| 70 onShutdown(); | |
| 71 } | |
| 72 isolateLifecyclePort.close(); | 69 isolateLifecyclePort.close(); |
| 73 scriptLoadPort.close(); | 70 scriptLoadPort.close(); |
| 74 for (var client in clients) { | 71 for (var client in clients) { |
| 75 client.close(); | 72 client.close(); |
| 76 } | 73 } |
| 74 // Call embedder shutdown hook after the internal shutdown. |
| 75 if (onShutdown != null) { |
| 76 onShutdown(); |
| 77 } |
| 77 _onExit(); | 78 _onExit(); |
| 78 } | 79 } |
| 79 | 80 |
| 80 void messageHandler(message) { | 81 void messageHandler(message) { |
| 81 if (message is String) { | 82 if (message is String) { |
| 82 // This is an event intended for all clients. | 83 // This is an event intended for all clients. |
| 83 _eventMessageHandler(message); | 84 _eventMessageHandler(message); |
| 84 return; | 85 return; |
| 85 } | 86 } |
| 86 if (message is Uint8List) { | 87 if (message is Uint8List) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 162 } |
| 162 | 163 |
| 163 void _registerIsolate(int port_id, SendPort sp, String name) { | 164 void _registerIsolate(int port_id, SendPort sp, String name) { |
| 164 var service = new VMService(); | 165 var service = new VMService(); |
| 165 service.runningIsolates.isolateStartup(port_id, sp, name); | 166 service.runningIsolates.isolateStartup(port_id, sp, name); |
| 166 } | 167 } |
| 167 | 168 |
| 168 void _onStart() native "VMService_OnStart"; | 169 void _onStart() native "VMService_OnStart"; |
| 169 | 170 |
| 170 void _onExit() native "VMService_OnExit"; | 171 void _onExit() native "VMService_OnExit"; |
| OLD | NEW |