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

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
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..ccf2e8aba209e9d9d5df5908b87944ae20836009 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,32 @@ 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) {
+ void _handleNameResponse(String responseString) {
var response;
try {
response = JSON.parse(responseString);
} catch (e) {
- id = 'Error retrieving isolate id.';
+ name = 'Error retrieving isolate name.';
return;
}
- id = response['id'];
+ name = response['name'];
siva 2013/08/01 18:16:18 why not move this line into the try block. respon
Cutch 2013/08/01 22:22:04 Done.
+ if (name == null) {
+ name = 'Error retrieving isolate name.';
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698