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

Side by Side Diff: runtime/vm/service.cc

Issue 1255003003: Make VM service id handling JSON-RPC 2 compliant. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: cr Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service/message.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 void Service::InvokeMethod(Isolate* isolate, const Array& msg) { 502 void Service::InvokeMethod(Isolate* isolate, const Array& msg) {
503 ASSERT(isolate != NULL); 503 ASSERT(isolate != NULL);
504 ASSERT(!msg.IsNull()); 504 ASSERT(!msg.IsNull());
505 ASSERT(msg.Length() == 6); 505 ASSERT(msg.Length() == 6);
506 506
507 { 507 {
508 StackZone zone(isolate); 508 StackZone zone(isolate);
509 HANDLESCOPE(isolate); 509 HANDLESCOPE(isolate);
510 510
511 Instance& reply_port = Instance::Handle(isolate); 511 Instance& reply_port = Instance::Handle(isolate);
512 String& seq = String::Handle(isolate); 512 Instance& seq = String::Handle(isolate);
513 String& method_name = String::Handle(isolate); 513 String& method_name = String::Handle(isolate);
514 Array& param_keys = Array::Handle(isolate); 514 Array& param_keys = Array::Handle(isolate);
515 Array& param_values = Array::Handle(isolate); 515 Array& param_values = Array::Handle(isolate);
516 reply_port ^= msg.At(1); 516 reply_port ^= msg.At(1);
517 seq ^= msg.At(2); 517 seq ^= msg.At(2);
518 method_name ^= msg.At(3); 518 method_name ^= msg.At(3);
519 param_keys ^= msg.At(4); 519 param_keys ^= msg.At(4);
520 param_values ^= msg.At(5); 520 param_values ^= msg.At(5);
521 521
522 ASSERT(!method_name.IsNull()); 522 ASSERT(!method_name.IsNull());
523 ASSERT(!seq.IsNull()); 523 ASSERT(seq.IsNull() || seq.IsString() || seq.IsNumber());
524 ASSERT(!param_keys.IsNull()); 524 ASSERT(!param_keys.IsNull());
525 ASSERT(!param_values.IsNull()); 525 ASSERT(!param_values.IsNull());
526 ASSERT(param_keys.Length() == param_values.Length()); 526 ASSERT(param_keys.Length() == param_values.Length());
527 527
528 if (!reply_port.IsSendPort()) { 528 if (!reply_port.IsSendPort()) {
529 FATAL("SendPort expected."); 529 FATAL("SendPort expected.");
530 } 530 }
531 531
532 JSONStream js; 532 JSONStream js;
533 js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), 533 js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(),
(...skipping 2532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 ServiceMethodDescriptor& method = service_methods_[i]; 3066 ServiceMethodDescriptor& method = service_methods_[i];
3067 if (strcmp(method_name, method.name) == 0) { 3067 if (strcmp(method_name, method.name) == 0) {
3068 return &method; 3068 return &method;
3069 } 3069 }
3070 } 3070 }
3071 return NULL; 3071 return NULL;
3072 } 3072 }
3073 3073
3074 3074
3075 } // namespace dart 3075 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/json_stream.cc ('k') | runtime/vm/service/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698