Chromium Code Reviews| Index: runtime/vm/service/running_isolates.dart |
| diff --git a/runtime/vm/service/running_isolates.dart b/runtime/vm/service/running_isolates.dart |
| index 7f6b045cb40277888f88511bf952ee4c04e1a016..8c7bc81abfcf7090f669af1134f922d0315d2433 100644 |
| --- a/runtime/vm/service/running_isolates.dart |
| +++ b/runtime/vm/service/running_isolates.dart |
| @@ -6,15 +6,22 @@ part of vmservice; |
| class RunningIsolates implements MessageRouter { |
| final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>(); |
| + int _rootPortId; |
| RunningIsolates(); |
| void isolateStartup(int portId, SendPort sp, String name) { |
| + if (_rootPortId == null) { |
| + _rootPortId = portId; |
| + } |
| var ri = new RunningIsolate(portId, sp, name); |
| isolates[portId] = ri; |
| } |
| void isolateShutdown(int portId, SendPort sp) { |
| + if (_rootPortId == portId) { |
| + _rootPortId = null; |
| + } |
| isolates.remove(portId); |
| } |
| @@ -32,12 +39,17 @@ class RunningIsolates implements MessageRouter { |
| return message.response; |
| } |
| var isolateId; |
| - try { |
| - isolateId = int.parse(message.path[1]); |
| - } catch (e) { |
| - message.setErrorResponse('Could not parse isolate id: $e'); |
| - return message.response; |
| + if ((message.path[1] == 'root') && (_rootPortId != null)) { |
| + isolateId = _rootPortId; |
|
turnidge
2014/03/24 20:22:13
so isolates/root is an alias to whatever the root
Cutch
2014/03/25 14:39:06
This alias will never been seen by Observatory, it
|
| + } else { |
| + try { |
| + isolateId = int.parse(message.path[1]); |
| + } catch (e) { |
| + message.setErrorResponse('Could not parse isolate id: $e'); |
| + return message.response; |
| + } |
| } |
| + assert(isolateId != null); |
| var isolate = isolates[isolateId]; |
| if (isolate == null) { |
| message.setErrorResponse('Cannot find isolate id: $isolateId'); |