OLD | NEW |
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 "platform/globals.h" | 8 #include "platform/globals.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 | 668 |
669 JSONObject jsobj(js); | 669 JSONObject jsobj(js); |
670 jsobj.AddProperty("type", "Error"); | 670 jsobj.AddProperty("type", "Error"); |
671 jsobj.AddProperty("id", ""); | 671 jsobj.AddProperty("id", ""); |
672 jsobj.AddProperty("kind", kind); | 672 jsobj.AddProperty("kind", kind); |
673 jsobj.AddProperty("message", buffer); | 673 jsobj.AddProperty("message", buffer); |
674 PrintArgumentsAndOptions(jsobj, js); | 674 PrintArgumentsAndOptions(jsobj, js); |
675 } | 675 } |
676 | 676 |
677 | 677 |
678 void Service::HandleIsolateMessage(Isolate* isolate, const Instance& msg) { | 678 void Service::HandleIsolateMessage(Isolate* isolate, const Array& msg) { |
679 ASSERT(isolate != NULL); | 679 ASSERT(isolate != NULL); |
680 ASSERT(!msg.IsNull()); | 680 ASSERT(!msg.IsNull()); |
681 ASSERT(msg.IsArray()); | |
682 | 681 |
683 { | 682 { |
684 StackZone zone(isolate); | 683 StackZone zone(isolate); |
685 HANDLESCOPE(isolate); | 684 HANDLESCOPE(isolate); |
686 | 685 |
687 const Array& message = Array::Cast(msg); | |
688 // Message is a list with five entries. | 686 // Message is a list with five entries. |
689 ASSERT(message.Length() == 5); | 687 ASSERT(msg.Length() == 5); |
690 | 688 |
691 Instance& reply_port = Instance::Handle(isolate); | 689 Instance& reply_port = Instance::Handle(isolate); |
692 GrowableObjectArray& path = GrowableObjectArray::Handle(isolate); | 690 GrowableObjectArray& path = GrowableObjectArray::Handle(isolate); |
693 Array& option_keys = Array::Handle(isolate); | 691 Array& option_keys = Array::Handle(isolate); |
694 Array& option_values = Array::Handle(isolate); | 692 Array& option_values = Array::Handle(isolate); |
695 reply_port ^= message.At(1); | 693 reply_port ^= msg.At(1); |
696 path ^= message.At(2); | 694 path ^= msg.At(2); |
697 option_keys ^= message.At(3); | 695 option_keys ^= msg.At(3); |
698 option_values ^= message.At(4); | 696 option_values ^= msg.At(4); |
699 | 697 |
700 ASSERT(!path.IsNull()); | 698 ASSERT(!path.IsNull()); |
701 ASSERT(!option_keys.IsNull()); | 699 ASSERT(!option_keys.IsNull()); |
702 ASSERT(!option_values.IsNull()); | 700 ASSERT(!option_values.IsNull()); |
703 // Same number of option keys as values. | 701 // Same number of option keys as values. |
704 ASSERT(option_keys.Length() == option_values.Length()); | 702 ASSERT(option_keys.Length() == option_values.Length()); |
705 | 703 |
706 if (!reply_port.IsSendPort()) { | 704 if (!reply_port.IsSendPort()) { |
707 FATAL("SendPort expected."); | 705 FATAL("SendPort expected."); |
708 } | 706 } |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2316 while (current != NULL) { | 2314 while (current != NULL) { |
2317 if (strcmp(name, current->name()) == 0) { | 2315 if (strcmp(name, current->name()) == 0) { |
2318 return current; | 2316 return current; |
2319 } | 2317 } |
2320 current = current->next(); | 2318 current = current->next(); |
2321 } | 2319 } |
2322 return NULL; | 2320 return NULL; |
2323 } | 2321 } |
2324 | 2322 |
2325 } // namespace dart | 2323 } // namespace dart |
OLD | NEW |