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

Side by Side Diff: runtime/bin/vmservice/running_isolates.dart

Issue 106193003: Cleanup VM service (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/vmservice/server.dart » ('j') | runtime/bin/vmservice/server.dart » ('J')
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 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();
(...skipping 22 matching lines...) Expand all
33 'name': runningIsolate.name 33 'name': runningIsolate.name
34 }); 34 });
35 }); 35 });
36 result['type'] = 'IsolateList'; 36 result['type'] = 'IsolateList';
37 result['members'] = members; 37 result['members'] = members;
38 request.setResponse(JSON.encode(result)); 38 request.setResponse(JSON.encode(result));
39 } 39 }
40 40
41 Future route(ServiceRequest request) { 41 Future route(ServiceRequest request) {
42 if (request.pathSegments.length == 0) { 42 if (request.pathSegments.length == 0) {
43 return null; 43 request.setErrorResponse('No route for: $path');
44 return new Future.value(request);
44 } 45 }
45 if (request.pathSegments[0] != 'isolates') { 46 if (request.pathSegments[0] != 'isolates') {
46 return null; 47 request.setErrorResponse('No route for: $path');
48 return new Future.value(request);
47 } 49 }
48 if (request.pathSegments.length == 1) { 50 if (request.pathSegments.length == 1) {
49 // Requesting list of running isolates. 51 // Requesting list of running isolates.
50 _isolateCollectionRequest(request); 52 _isolateCollectionRequest(request);
51 return new Future.value(request); 53 return new Future.value(request);
52 } 54 }
53 var isolateId; 55 var isolateId;
54 try { 56 try {
55 isolateId = int.parse(request.pathSegments[1]); 57 isolateId = int.parse(request.pathSegments[1]);
56 } catch (e) { 58 } catch (e) {
57 request.setErrorResponse('Could not parse isolate id: $e'); 59 request.setErrorResponse('Could not parse isolate id: $e');
58 return new Future.value(request); 60 return new Future.value(request);
59 } 61 }
60 var isolate = isolates[isolateId]; 62 var isolate = isolates[isolateId];
61 if (isolate == null) { 63 if (isolate == null) {
62 request.setErrorResponse('Cannot find isolate id: $isolateId'); 64 request.setErrorResponse('Cannot find isolate id: $isolateId');
63 return new Future.value(request); 65 return new Future.value(request);
64 } 66 }
65 // Consume '/isolates/isolateId' 67 // Consume '/isolates/isolateId'
66 request.pathSegments.removeRange(0, 2); 68 request.pathSegments.removeRange(0, 2);
67 if (request.pathSegments.length == 0) { 69 if (request.pathSegments.length == 0) {
68 // The request is now empty. 70 // The request is now empty.
69 request.setErrorResponse('No request for isolate: /isolates/$isolateId'); 71 request.setErrorResponse('No request for isolate: /isolates/$isolateId');
70 return new Future.value(request); 72 return new Future.value(request);
71 } 73 }
72 return isolate.route(request); 74 return isolate.route(request);
73 } 75 }
74 } 76 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/vmservice/server.dart » ('j') | runtime/bin/vmservice/server.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698