| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include <string.h> | 4 #include <string.h> |
| 5 #include <stdlib.h> | 5 #include <stdlib.h> |
| 6 #include <stdio.h> | 6 #include <stdio.h> |
| 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 | 9 |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 3 == message->value.as_array.length) { | 86 3 == message->value.as_array.length) { |
| 87 // Use .as_array and .as_int32 to access the data in the Dart_CObject. | 87 // Use .as_array and .as_int32 to access the data in the Dart_CObject. |
| 88 Dart_CObject* param0 = message->value.as_array.values[0]; | 88 Dart_CObject* param0 = message->value.as_array.values[0]; |
| 89 Dart_CObject* param1 = message->value.as_array.values[1]; | 89 Dart_CObject* param1 = message->value.as_array.values[1]; |
| 90 Dart_CObject* param2 = message->value.as_array.values[2]; | 90 Dart_CObject* param2 = message->value.as_array.values[2]; |
| 91 if (param0->type == Dart_CObject_kInt32 && | 91 if (param0->type == Dart_CObject_kInt32 && |
| 92 param1->type == Dart_CObject_kInt32 && | 92 param1->type == Dart_CObject_kInt32 && |
| 93 param2->type == Dart_CObject_kSendPort) { | 93 param2->type == Dart_CObject_kSendPort) { |
| 94 int seed = param0->value.as_int32; | 94 int seed = param0->value.as_int32; |
| 95 int length = param1->value.as_int32; | 95 int length = param1->value.as_int32; |
| 96 reply_port_id = param2->value.as_send_port; | 96 reply_port_id = param2->value.as_send_port.id; |
| 97 uint8_t* values = randomArray(seed, length); | 97 uint8_t* values = randomArray(seed, length); |
| 98 | 98 |
| 99 if (values != NULL) { | 99 if (values != NULL) { |
| 100 Dart_CObject result; | 100 Dart_CObject result; |
| 101 result.type = Dart_CObject_kTypedData; | 101 result.type = Dart_CObject_kTypedData; |
| 102 result.value.as_typed_data.type = Dart_TypedData_kUint8; | 102 result.value.as_typed_data.type = Dart_TypedData_kUint8; |
| 103 result.value.as_typed_data.values = values; | 103 result.value.as_typed_data.values = values; |
| 104 result.value.as_typed_data.length = length; | 104 result.value.as_typed_data.length = length; |
| 105 Dart_PostCObject(reply_port_id, &result); | 105 Dart_PostCObject(reply_port_id, &result); |
| 106 free(values); | 106 free(values); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 if (strcmp(no_scope_function_list[i].name, cname) == 0) { | 179 if (strcmp(no_scope_function_list[i].name, cname) == 0) { |
| 180 *auto_setup_scope = false; | 180 *auto_setup_scope = false; |
| 181 result = no_scope_function_list[i].function; | 181 result = no_scope_function_list[i].function; |
| 182 break; | 182 break; |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 Dart_ExitScope(); | 186 Dart_ExitScope(); |
| 187 return result; | 187 return result; |
| 188 } | 188 } |
| OLD | NEW |