| 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 "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 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 method_name ^= msg.At(3); | 833 method_name ^= msg.At(3); |
| 834 param_keys ^= msg.At(4); | 834 param_keys ^= msg.At(4); |
| 835 param_values ^= msg.At(5); | 835 param_values ^= msg.At(5); |
| 836 | 836 |
| 837 ASSERT(!method_name.IsNull()); | 837 ASSERT(!method_name.IsNull()); |
| 838 ASSERT(seq.IsNull() || seq.IsString() || seq.IsNumber()); | 838 ASSERT(seq.IsNull() || seq.IsString() || seq.IsNumber()); |
| 839 ASSERT(!param_keys.IsNull()); | 839 ASSERT(!param_keys.IsNull()); |
| 840 ASSERT(!param_values.IsNull()); | 840 ASSERT(!param_values.IsNull()); |
| 841 ASSERT(param_keys.Length() == param_values.Length()); | 841 ASSERT(param_keys.Length() == param_values.Length()); |
| 842 | 842 |
| 843 if (!reply_port.IsSendPort()) { | 843 // We expect a reply port unless there is a null sequence id, |
| 844 // which indicates that no reply should be sent. We use this in |
| 845 // tests. |
| 846 if (!seq.IsNull() && !reply_port.IsSendPort()) { |
| 844 FATAL("SendPort expected."); | 847 FATAL("SendPort expected."); |
| 845 } | 848 } |
| 846 | 849 |
| 847 JSONStream js; | 850 JSONStream js; |
| 848 js.Setup(zone.GetZone(), SendPort::Cast(reply_port).Id(), seq, method_name, | 851 Dart_Port reply_port_id = |
| 849 param_keys, param_values, parameters_are_dart_objects); | 852 (reply_port.IsNull() ? ILLEGAL_PORT : SendPort::Cast(reply_port).Id()); |
| 853 js.Setup(zone.GetZone(), reply_port_id, seq, method_name, param_keys, |
| 854 param_values, parameters_are_dart_objects); |
| 850 | 855 |
| 851 // RPC came in with a custom service id zone. | 856 // RPC came in with a custom service id zone. |
| 852 const char* id_zone_param = js.LookupParam("_idZone"); | 857 const char* id_zone_param = js.LookupParam("_idZone"); |
| 853 | 858 |
| 854 if (id_zone_param != NULL) { | 859 if (id_zone_param != NULL) { |
| 855 // Override id zone. | 860 // Override id zone. |
| 856 if (strcmp("default", id_zone_param) == 0) { | 861 if (strcmp("default", id_zone_param) == 0) { |
| 857 // Ring with eager id allocation. This is the default ring and default | 862 // Ring with eager id allocation. This is the default ring and default |
| 858 // policy. | 863 // policy. |
| 859 // Nothing to do. | 864 // Nothing to do. |
| (...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4122 if (strcmp(method_name, method.name) == 0) { | 4127 if (strcmp(method_name, method.name) == 0) { |
| 4123 return &method; | 4128 return &method; |
| 4124 } | 4129 } |
| 4125 } | 4130 } |
| 4126 return NULL; | 4131 return NULL; |
| 4127 } | 4132 } |
| 4128 | 4133 |
| 4129 #endif // !PRODUCT | 4134 #endif // !PRODUCT |
| 4130 | 4135 |
| 4131 } // namespace dart | 4136 } // namespace dart |
| OLD | NEW |