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 "bin/builtin.h" | 5 #include "bin/builtin.h" |
6 #include "vm/compiler.h" | 6 #include "vm/compiler.h" |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "include/dart_mirrors_api.h" | 8 #include "include/dart_mirrors_api.h" |
9 #include "include/dart_native_api.h" | 9 #include "include/dart_native_api.h" |
10 #include "include/dart_tools_api.h" | 10 #include "include/dart_tools_api.h" |
(...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2060 "Internal Dart data pointers have been acquired, " | 2060 "Internal Dart data pointers have been acquired, " |
2061 "please release them using Dart_TypedDataReleaseData."); | 2061 "please release them using Dart_TypedDataReleaseData."); |
2062 } | 2062 } |
2063 | 2063 |
2064 // Now modify the values in the directly accessible array and then check | 2064 // Now modify the values in the directly accessible array and then check |
2065 // it we see the changes back in dart. | 2065 // it we see the changes back in dart. |
2066 for (int i = 0; i < kLength; i++) { | 2066 for (int i = 0; i < kLength; i++) { |
2067 dataP[i] += 10; | 2067 dataP[i] += 10; |
2068 } | 2068 } |
2069 | 2069 |
2070 // Release direct accesss to the typed data object. | 2070 // Release direct access to the typed data object. |
2071 result = Dart_TypedDataReleaseData(array); | 2071 result = Dart_TypedDataReleaseData(array); |
2072 EXPECT_VALID(result); | 2072 EXPECT_VALID(result); |
2073 | 2073 |
2074 // Invoke the dart function in order to check the modified values. | 2074 // Invoke the dart function in order to check the modified values. |
2075 result = Dart_Invoke(lib, NewString("testMain"), 1, dart_args); | 2075 result = Dart_Invoke(lib, NewString("testMain"), 1, dart_args); |
2076 EXPECT_VALID(result); | 2076 EXPECT_VALID(result); |
2077 } | 2077 } |
2078 | 2078 |
2079 | 2079 |
2080 static void TestTypedDataDirectAccess1() { | 2080 static void TestTypedDataDirectAccess1() { |
(...skipping 7833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9914 EXPECT_VALID(result); | 9914 EXPECT_VALID(result); |
9915 result = Dart_FinalizeLoading(false); | 9915 result = Dart_FinalizeLoading(false); |
9916 EXPECT_VALID(result); | 9916 EXPECT_VALID(result); |
9917 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); | 9917 result = Dart_Invoke(lib, NewString("foozoo"), 0, NULL); |
9918 EXPECT(Dart_IsError(result)); | 9918 EXPECT(Dart_IsError(result)); |
9919 } | 9919 } |
9920 | 9920 |
9921 #endif // !PRODUCT | 9921 #endif // !PRODUCT |
9922 | 9922 |
9923 } // namespace dart | 9923 } // namespace dart |
OLD | NEW |