| 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 part of vmservice; | 5 part of vmservice; |
| 6 | 6 |
| 7 class RunningIsolates implements ServiceRequestRouter { | 7 class RunningIsolates implements ServiceRequestRouter { |
| 8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>(); | 8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>(); |
| 9 | 9 |
| 10 RunningIsolates(); | 10 RunningIsolates(); |
| 11 | 11 |
| 12 void isolateStartup(SendPort sp) { | 12 void isolateStartup(SendPort sp, String name) { |
| 13 if (isolates[sp.hashCode] != null) { | 13 if (isolates[sp.hashCode] != null) { |
| 14 throw new StateError('Duplicate isolate startup.'); | 14 throw new StateError('Duplicate isolate startup.'); |
| 15 } | 15 } |
| 16 var ri = new RunningIsolate(sp); | 16 var ri = new RunningIsolate(sp, name); |
| 17 isolates[sp.hashCode] = ri; | 17 isolates[sp.hashCode] = ri; |
| 18 ri._sendNameRequest(); | |
| 19 } | 18 } |
| 20 | 19 |
| 21 void isolateShutdown(SendPort sp) { | 20 void isolateShutdown(SendPort sp) { |
| 22 if (isolates[sp.hashCode] == null) { | 21 if (isolates[sp.hashCode] == null) { |
| 23 throw new StateError('Unknown isolate.'); | 22 throw new StateError('Unknown isolate.'); |
| 24 } | 23 } |
| 25 isolates.remove(sp.hashCode); | 24 isolates.remove(sp.hashCode); |
| 26 } | 25 } |
| 27 | 26 |
| 28 void _isolateCollectionRequest(ServiceRequest request) { | 27 void _isolateCollectionRequest(ServiceRequest request) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 // Consume '/isolates/isolateId' | 65 // Consume '/isolates/isolateId' |
| 67 request.pathSegments.removeRange(0, 2); | 66 request.pathSegments.removeRange(0, 2); |
| 68 if (request.pathSegments.length == 0) { | 67 if (request.pathSegments.length == 0) { |
| 69 // The request is now empty. | 68 // The request is now empty. |
| 70 request.setErrorResponse('No request for isolate: /isolates/$isolateId'); | 69 request.setErrorResponse('No request for isolate: /isolates/$isolateId'); |
| 71 return new Future.value(request); | 70 return new Future.value(request); |
| 72 } | 71 } |
| 73 return isolate.route(request); | 72 return isolate.route(request); |
| 74 } | 73 } |
| 75 } | 74 } |
| OLD | NEW |