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

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

Issue 19622003: VM Service isolate listing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 part of vmservice;
6
7 class RunningIsolate implements ServiceRequestRouter {
8 final SendPort sendPort;
9 String id = 'Unknown';
10
11
12 RunningIsolate(this.sendPort);
13
14
siva 2013/07/19 17:41:16 extraa blank lines here and above?
Cutch 2013/07/19 18:15:02 Done.
15 Future sendMessage(String request) {
16 final completer = new Completer.sync();
17 final receivePort = new ReceivePort();
18 sendServiceMessage(sendPort, receivePort, request);
19 receivePort.receive((value, ignoreReplyTo) {
20 receivePort.close();
21 if (value is Exception) {
22 completer.completeError(value);
23 } else {
24 completer.complete(value);
25 }
26 });
27 return completer.future;
28 }
29
30
31 bool route(ServiceRequest request) {
32 // Do nothing for now.
33 return false;
34 }
35
36 void sendIdRequest() {
37 String request = JSON.stringify({'p': ['id'], 'k': [], 'v': []});
38 sendMessage(request).then(_handleIdResponse);
39 }
40
41 void _handleIdResponse(responseString) {
42 Map response;
siva 2013/07/19 17:41:16 ditto comment regarding style guide preference for
Cutch 2013/07/19 18:15:02 Done.
43 try {
44 response = JSON.parse(responseString);
45 } catch (e) {
46 id = 'Error retrieving isolate id.';
47 return;
48 }
49 id = response['id'];
50 }
51
52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698