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 | 4 |
5 #include "embedders/openglui/common/extension.h" | 5 #include "embedders/openglui/common/extension.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 | 10 |
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 Dart_CObject* param1 = message->value.as_array.values[1]; | 868 Dart_CObject* param1 = message->value.as_array.values[1]; |
869 if (param0->type == Dart_CObject::kInt32 && | 869 if (param0->type == Dart_CObject::kInt32 && |
870 param1->type == Dart_CObject::kInt32) { | 870 param1->type == Dart_CObject::kInt32) { |
871 int length = param0->value.as_int32; | 871 int length = param0->value.as_int32; |
872 int seed = param1->value.as_int32; | 872 int seed = param1->value.as_int32; |
873 | 873 |
874 uint8_t* values = RandomArray(seed, length); | 874 uint8_t* values = RandomArray(seed, length); |
875 | 875 |
876 if (values != NULL) { | 876 if (values != NULL) { |
877 Dart_CObject result; | 877 Dart_CObject result; |
878 result.type = Dart_CObject::kUint8Array; | 878 result.type = Dart_CObject::kTypedData; |
879 result.value.as_byte_array.values = values; | 879 result.value.as_typed_data.type = Dart_CObject::kUint8Array; |
880 result.value.as_byte_array.length = length; | 880 result.value.as_typed_data.values = values; |
| 881 result.value.as_typed_data.length = length; |
881 Dart_PostCObject(reply_port_id, &result); | 882 Dart_PostCObject(reply_port_id, &result); |
882 free(values); | 883 free(values); |
883 // It is OK that result is destroyed when function exits. | 884 // It is OK that result is destroyed when function exits. |
884 // Dart_PostCObject has copied its data. | 885 // Dart_PostCObject has copied its data. |
885 return; | 886 return; |
886 } | 887 } |
887 } | 888 } |
888 } | 889 } |
889 Dart_CObject result; | 890 Dart_CObject result; |
890 result.type = Dart_CObject::kNull; | 891 result.type = Dart_CObject::kNull; |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1726 HandleError(Dart_StringToCString(name, &cname)); | 1727 HandleError(Dart_StringToCString(name, &cname)); |
1727 for (int i = 0; function_list[i].name != NULL; ++i) { | 1728 for (int i = 0; function_list[i].name != NULL; ++i) { |
1728 if (strcmp(function_list[i].name, cname) == 0) { | 1729 if (strcmp(function_list[i].name, cname) == 0) { |
1729 result = function_list[i].function; | 1730 result = function_list[i].function; |
1730 break; | 1731 break; |
1731 } | 1732 } |
1732 } | 1733 } |
1733 Dart_ExitScope(); | 1734 Dart_ExitScope(); |
1734 return result; | 1735 return result; |
1735 } | 1736 } |
OLD | NEW |