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

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

Issue 19870006: Support stacktrace and objecthistogram service commands (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/.gitignore ('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
index 540c5ea36ad4e58ebaa85df749b2aadabb2825da..6c7749a6e2f5606cab1a7d5b8da81744512e8f8a 100644
--- a/runtime/bin/vmservice/running_isolate.dart
+++ b/runtime/bin/vmservice/running_isolate.dart
@@ -6,11 +6,11 @@ part of vmservice;
class RunningIsolate implements ServiceRequestRouter {
final SendPort sendPort;
- String id = 'Unknown';
+ String name = 'Unknown';
RunningIsolate(this.sendPort);
- Future sendMessage(String request) {
+ Future sendMessage(List request) {
final completer = new Completer.sync();
final receivePort = new ReceivePort();
sendServiceMessage(sendPort, receivePort, request);
@@ -25,24 +25,31 @@ class RunningIsolate implements ServiceRequestRouter {
return completer.future;
}
- bool route(ServiceRequest request) {
- // Do nothing for now.
- return false;
+ Future route(ServiceRequest request) {
+ // Send message to isolate.
+ var message = request.toServiceCallMessage();
+ return sendMessage(message).then((response) {
+ request.setResponse(response);
+ return new Future.value(request);
+ });
}
- void sendIdRequest() {
- var request = JSON.stringify({'p': ['id'], 'k': [], 'v': []});
- sendMessage(request).then(_handleIdResponse);
+ void _sendNameRequest() {
+ var request = new ServiceRequest();
+ request.parse(Uri.parse('/name'));
+ sendMessage(request.toServiceCallMessage()).then(_handleNameResponse);
}
- void _handleIdResponse(responseString) {
- var response;
+ void _handleNameResponse(String responseString) {
try {
- response = JSON.parse(responseString);
+ var response = JSON.parse(responseString);
+ name = response['name'];
} catch (e) {
- id = 'Error retrieving isolate id.';
+ name = 'Error retrieving isolate name.';
return;
}
- id = response['id'];
+ if (name == null) {
+ name = 'Error retrieving isolate name.';
+ }
}
}
« no previous file with comments | « runtime/bin/vmservice/.gitignore ('k') | runtime/bin/vmservice/running_isolates.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698