Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: runtime/vm/dart_api_impl_test.cc

Issue 12093071: - Change the layout of external typed array objects to avoid the extra indirection when accessing e… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "include/dart_api.h" 5 #include "include/dart_api.h"
6 #include "platform/assert.h" 6 #include "platform/assert.h"
7 #include "platform/json.h" 7 #include "platform/json.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart_api_impl.h" 10 #include "vm/dart_api_impl.h"
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 // Check that result is true. 1210 // Check that result is true.
1211 EXPECT_VALID(result); 1211 EXPECT_VALID(result);
1212 EXPECT(Dart_IsBoolean(result)); 1212 EXPECT(Dart_IsBoolean(result));
1213 bool value = false; 1213 bool value = false;
1214 result = Dart_BooleanValue(result, &value); 1214 result = Dart_BooleanValue(result, &value);
1215 EXPECT_VALID(result); 1215 EXPECT_VALID(result);
1216 EXPECT(value); 1216 EXPECT(value);
1217 } 1217 }
1218 1218
1219 1219
1220 1220 static void ExternalByteArrayCallbackFinalizer(Dart_Handle handle, void* peer) {
1221 static void ExternalByteArrayCallbackFinalizer(void* peer) { 1221 Dart_DeletePersistentHandle(handle);
1222 *static_cast<int*>(peer) = 42; 1222 *static_cast<int*>(peer) = 42;
1223 } 1223 }
1224 1224
1225 1225
1226 TEST_CASE(ExternalByteArrayCallback) { 1226 TEST_CASE(ExternalByteArrayCallback) {
1227 int peer = 0; 1227 int peer = 0;
1228 { 1228 {
1229 Dart_EnterScope(); 1229 Dart_EnterScope();
1230 uint8_t data[] = { 1, 2, 3, 4 }; 1230 uint8_t data[] = { 1, 2, 3, 4 };
1231 Dart_Handle obj = Dart_NewExternalByteArray( 1231 Dart_Handle obj = Dart_NewExternalByteArray(
(...skipping 6298 matching lines...) Expand 10 before | Expand all | Expand 10 after
7530 NULL); 7530 NULL);
7531 int64_t value = 0; 7531 int64_t value = 0;
7532 result = Dart_IntegerToInt64(result, &value); 7532 result = Dart_IntegerToInt64(result, &value);
7533 EXPECT_VALID(result); 7533 EXPECT_VALID(result);
7534 EXPECT_EQ(260, value); 7534 EXPECT_EQ(260, value);
7535 } 7535 }
7536 7536
7537 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64). 7537 #endif // defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64).
7538 7538
7539 } // namespace dart 7539 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/dart_api_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698