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

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

Issue 112223002: WebSocket client for VM service (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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/vmservice_dartium.dart
diff --git a/runtime/bin/vmservice/vmservice_dartium.dart b/runtime/bin/vmservice/vmservice_dartium.dart
index 249455dd9bb85e6996705e2f1488957a2d237e1f..a05d1187d940b202697115543365783b27623b78 100644
--- a/runtime/bin/vmservice/vmservice_dartium.dart
+++ b/runtime/bin/vmservice/vmservice_dartium.dart
@@ -15,20 +15,18 @@ RawReceivePort _requestPort;
// The native method that is called to post the response back to DevTools.
void postResponse(String response, int cookie) native "VMService_PostResponse";
-void handleRequest(service, String uri, cookie) {
- var serviceRequest = new ServiceRequest();
- var r = serviceRequest.parse(Uri.parse(uri));
- if (r) {
- var f = service.runningIsolates.route(serviceRequest);
- assert(f != null);
- f.then((_) {
- postResponse(serviceRequest.response, cookie);
- }).catchError((e) {
+void handleMessage(service, uri, cookie) {
+ var message = new Message.fromUri(uri);
+ var client = new HttpRequestClient(request, service);
+ message.future.then((response) {
+ try {
+ postResponse(response, cookie);
+ } catch (_) {
// Error posting response back to Dartium.
- });
- return;
- }
- postResponse(serviceRequest.response, cookie);
+ }
+ });
+ // Send message for processing.
+ service.route(message);
}
main() {
@@ -45,11 +43,11 @@ main() {
if (message.length != 2) {
return;
}
- var uri = message[0];
- if (uri is! String) {
+ if (message[0] is! String) {
return;
}
+ var uri = Uri.parse(message[0]);
var cookie = message[1];
- handleRequest(service, uri, cookie);
+ handleMessage(service, uri, cookie);
});
}

Powered by Google App Engine
This is Rietveld 408576698