Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(72)

Side by Side Diff: sdk/lib/vmservice/running_isolates.dart

Issue 2980733003: Introduced support for external services registration in the ServiceProtocol (Closed)
Patch Set: Address comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « sdk/lib/vmservice/running_isolate.dart ('k') | sdk/lib/vmservice/vmservice.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 dart._vmservice; 5 part of dart._vmservice;
6 6
7 class RunningIsolates implements MessageRouter { 7 class RunningIsolates implements MessageRouter {
8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>(); 8 final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>();
9 int _rootPortId; 9 int _rootPortId;
10 10
11 RunningIsolates(); 11 RunningIsolates();
12 12
13 void isolateStartup(int portId, SendPort sp, String name) { 13 void isolateStartup(int portId, SendPort sp, String name) {
14 if (_rootPortId == null) { 14 if (_rootPortId == null) {
15 _rootPortId = portId; 15 _rootPortId = portId;
16 } 16 }
17 var ri = new RunningIsolate(portId, sp, name); 17 var ri = new RunningIsolate(portId, sp, name);
18 isolates[portId] = ri; 18 isolates[portId] = ri;
19 } 19 }
20 20
21 void isolateShutdown(int portId, SendPort sp) { 21 void isolateShutdown(int portId, SendPort sp) {
22 if (_rootPortId == portId) { 22 if (_rootPortId == portId) {
23 _rootPortId = null; 23 _rootPortId = null;
24 } 24 }
25 isolates.remove(portId); 25 isolates.remove(portId);
26 } 26 }
27 27
28 Future<String> route(Message message) { 28 Future<String> routeRequest(Message message) {
29 String isolateParam = message.params['isolateId']; 29 String isolateParam = message.params['isolateId'];
30 int isolateId; 30 int isolateId;
31 if (!isolateParam.startsWith('isolates/')) { 31 if (!isolateParam.startsWith('isolates/')) {
32 message.setErrorResponse( 32 message.setErrorResponse(
33 kInvalidParams, "invalid 'isolateId' parameter: $isolateParam"); 33 kInvalidParams, "invalid 'isolateId' parameter: $isolateParam");
34 return message.response; 34 return message.response;
35 } 35 }
36 isolateParam = isolateParam.substring('isolates/'.length); 36 isolateParam = isolateParam.substring('isolates/'.length);
37 if (isolateParam == 'root') { 37 if (isolateParam == 'root') {
38 isolateId = _rootPortId; 38 isolateId = _rootPortId;
(...skipping 11 matching lines...) Expand all
50 // There is some chance that this isolate may have lived before, 50 // There is some chance that this isolate may have lived before,
51 // so return a sentinel rather than an error. 51 // so return a sentinel rather than an error.
52 var result = { 52 var result = {
53 'type': 'Sentinel', 53 'type': 'Sentinel',
54 'kind': 'Collected', 54 'kind': 'Collected',
55 'valueAsString': '<collected>', 55 'valueAsString': '<collected>',
56 }; 56 };
57 message.setResponse(encodeResult(message, result)); 57 message.setResponse(encodeResult(message, result));
58 return message.response; 58 return message.response;
59 } 59 }
60 return isolate.route(message); 60 return isolate.routeRequest(message);
61 } 61 }
62
63 void routeResponse(Message message) {}
62 } 64 }
OLDNEW
« no previous file with comments | « sdk/lib/vmservice/running_isolate.dart ('k') | sdk/lib/vmservice/vmservice.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698