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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 isolateLifecyclePort.close(); | 69 isolateLifecyclePort.close(); |
70 scriptLoadPort.close(); | 70 scriptLoadPort.close(); |
71 for (var client in clients) { | 71 // Create a copy of the set as a list because client.close() alters the set. |
| 72 var clientsList = clients.toList(); |
| 73 for (var client in clientsList) { |
72 client.close(); | 74 client.close(); |
73 } | 75 } |
74 // Call embedder shutdown hook after the internal shutdown. | 76 // Call embedder shutdown hook after the internal shutdown. |
75 if (onShutdown != null) { | 77 if (onShutdown != null) { |
76 onShutdown(); | 78 onShutdown(); |
77 } | 79 } |
78 _onExit(); | 80 _onExit(); |
79 } | 81 } |
80 | 82 |
81 void messageHandler(message) { | 83 void messageHandler(message) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 212 } |
211 | 213 |
212 void _registerIsolate(int port_id, SendPort sp, String name) { | 214 void _registerIsolate(int port_id, SendPort sp, String name) { |
213 var service = new VMService(); | 215 var service = new VMService(); |
214 service.runningIsolates.isolateStartup(port_id, sp, name); | 216 service.runningIsolates.isolateStartup(port_id, sp, name); |
215 } | 217 } |
216 | 218 |
217 void _onStart() native "VMService_OnStart"; | 219 void _onStart() native "VMService_OnStart"; |
218 | 220 |
219 void _onExit() native "VMService_OnExit"; | 221 void _onExit() native "VMService_OnExit"; |
OLD | NEW |