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

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
« no previous file with comments | « runtime/bin/vmservice/resources.dart ('k') | runtime/bin/vmservice/running_isolates.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..540c5ea36ad4e58ebaa85df749b2aadabb2825da
--- /dev/null
+++ b/runtime/bin/vmservice/running_isolate.dart
@@ -0,0 +1,48 @@
+// 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);
+
+ 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() {
+ var request = JSON.stringify({'p': ['id'], 'k': [], 'v': []});
+ sendMessage(request).then(_handleIdResponse);
+ }
+
+ void _handleIdResponse(responseString) {
+ var response;
+ try {
+ response = JSON.parse(responseString);
+ } catch (e) {
+ id = 'Error retrieving isolate id.';
+ return;
+ }
+ id = response['id'];
+ }
+}
« no previous file with comments | « runtime/bin/vmservice/resources.dart ('k') | runtime/bin/vmservice/running_isolates.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698