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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/vmservice/running_isolate.dart
diff --git a/runtime/bin/vmservice/running_isolate.dart b/runtime/bin/vmservice/running_isolate.dart
new file mode 100644
index 0000000000000000000000000000000000000000..8cdf79d619675c5b51a9d5fed28196e79ee08a65
--- /dev/null
+++ b/runtime/bin/vmservice/running_isolate.dart
@@ -0,0 +1,52 @@
+// 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 RunningIsolate implements ServiceRequestRouter {
+ final SendPort sendPort;
+ String id = 'Unknown';
+
+
+ RunningIsolate(this.sendPort);
+
+
siva 2013/07/19 17:41:16 extraa blank lines here and above?
Cutch 2013/07/19 18:15:02 Done.
+ Future sendMessage(String request) {
+ final completer = new Completer.sync();
+ final receivePort = new ReceivePort();
+ sendServiceMessage(sendPort, receivePort, request);
+ receivePort.receive((value, ignoreReplyTo) {
+ receivePort.close();
+ if (value is Exception) {
+ completer.completeError(value);
+ } else {
+ completer.complete(value);
+ }
+ });
+ return completer.future;
+ }
+
+
+ bool route(ServiceRequest request) {
+ // Do nothing for now.
+ return false;
+ }
+
+ void sendIdRequest() {
+ String request = JSON.stringify({'p': ['id'], 'k': [], 'v': []});
+ sendMessage(request).then(_handleIdResponse);
+ }
+
+ void _handleIdResponse(responseString) {
+ Map response;
siva 2013/07/19 17:41:16 ditto comment regarding style guide preference for
Cutch 2013/07/19 18:15:02 Done.
+ try {
+ response = JSON.parse(responseString);
+ } catch (e) {
+ id = 'Error retrieving isolate id.';
+ return;
+ }
+ id = response['id'];
+ }
+
+}

Powered by Google App Engine
This is Rietveld 408576698