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

Unified Diff: runtime/bin/vmservice/running_isolates.dart

Issue 125103004: Move service into VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/running_isolate.dart ('k') | runtime/bin/vmservice/vmservice.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/running_isolates.dart
diff --git a/runtime/bin/vmservice/running_isolates.dart b/runtime/bin/vmservice/running_isolates.dart
deleted file mode 100644
index db93d089c5d0354599a758d067fa0d1e03bad7ba..0000000000000000000000000000000000000000
--- a/runtime/bin/vmservice/running_isolates.dart
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of vmservice;
-
-class RunningIsolates implements MessageRouter {
- final Map<int, RunningIsolate> isolates = new Map<int, RunningIsolate>();
-
- RunningIsolates();
-
- void isolateStartup(int portId, SendPort sp, String name) {
- if (isolates[portId] != null) {
- throw new StateError('Duplicate isolate startup.');
- }
- var ri = new RunningIsolate(portId, sp, name);
- isolates[portId] = ri;
- }
-
- void isolateShutdown(int portId, SendPort sp) {
- if (isolates[portId] == null) {
- throw new StateError('Unknown isolate.');
- }
- isolates.remove(portId);
- }
-
- void _isolateCollectionRequest(Message message) {
- var members = [];
- var result = {};
- isolates.forEach((portId, runningIsolate) {
- members.add({
- 'type': 'Isolate',
- 'id': 'isolates/$portId',
- 'name': runningIsolate.name,
- });
- });
- result['type'] = 'IsolateList';
- result['members'] = members;
- message.setResponse(JSON.encode(result));
- }
-
- Future<String> route(Message message) {
- if (message.path.length == 0) {
- message.setErrorResponse('No path.');
- return message.response;
- }
- if (message.path[0] != 'isolates') {
- message.setErrorResponse('Path must begin with /isolates/.');
- return message.response;
- }
- if (message.path.length == 1) {
- // Requesting list of running isolates.
- _isolateCollectionRequest(message);
- 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;
- }
- var isolate = isolates[isolateId];
- if (isolate == null) {
- message.setErrorResponse('Cannot find isolate id: $isolateId');
- return message.response;
- }
- // Consume '/isolates/isolateId'
- message.path.removeRange(0, 2);
- if (message.path.length == 0) {
- // The message now has an empty path.
- message.setErrorResponse('Empty path for isolate: /isolates/$isolateId');
- return message.response;
- }
- return isolate.route(message);
- }
-}
« no previous file with comments | « runtime/bin/vmservice/running_isolate.dart ('k') | runtime/bin/vmservice/vmservice.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698