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

Unified Diff: runtime/vm/dart_api_impl.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, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 17875)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -2227,18 +2227,20 @@
}
-DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
- intptr_t length,
- void* peer,
- Dart_PeerFinalizer callback) {
+DART_EXPORT Dart_Handle Dart_NewExternalByteArray(
+ uint8_t* data,
+ intptr_t length,
+ void* peer,
+ Dart_WeakPersistentHandleFinalizer callback) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (data == NULL && length != 0) {
RETURN_NULL_ERROR(data);
}
CHECK_LENGTH(length, ExternalUint8Array::kMaxElements);
- return Api::NewHandle(
- isolate, ExternalUint8Array::New(data, length, peer, callback));
+ const ExternalUint8Array& obj = ExternalUint8Array::Handle(
+ ExternalUint8Array::New(data, length));
+ return reinterpret_cast<Dart_Handle>(obj.AddFinalizer(peer, callback));
}
@@ -2246,15 +2248,16 @@
uint8_t* data,
intptr_t length,
void* peer,
- Dart_PeerFinalizer callback) {
+ Dart_WeakPersistentHandleFinalizer callback) {
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (data == NULL && length != 0) {
RETURN_NULL_ERROR(data);
}
CHECK_LENGTH(length, ExternalUint8ClampedArray::kMaxElements);
- return Api::NewHandle(
- isolate, ExternalUint8ClampedArray::New(data, length, peer, callback));
+ const ExternalUint8ClampedArray& obj = ExternalUint8ClampedArray::Handle(
+ ExternalUint8ClampedArray::New(data, length));
+ return reinterpret_cast<Dart_Handle>(obj.AddFinalizer(peer, callback));
}
« no previous file with comments | « runtime/lib/byte_array.cc ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698