| Index: runtime/vm/dart_api_impl.cc
|
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
|
| index f1acf1c55617c9db862c4d8ac567aa2d93ac84bf..876710d32cfffbd1b63d348113836aad86e4fad6 100644
|
| --- a/runtime/vm/dart_api_impl.cc
|
| +++ b/runtime/vm/dart_api_impl.cc
|
| @@ -1610,8 +1610,6 @@ DART_EXPORT Dart_Handle Dart_ExternalStringGetPeer(Dart_Handle object,
|
| }
|
|
|
| // It's not an external string, return appropriate error.
|
| - // Note: this is invoked outside of the NoGCScope'd block above, since
|
| - // error messages allocate new handles.
|
| if (!RawObject::IsStringClassId(Api::ClassId(object))) {
|
| RETURN_TYPE_ERROR(Isolate::Current(), object, String);
|
| } else {
|
| @@ -2171,6 +2169,11 @@ DART_EXPORT bool Dart_IsByteArray(Dart_Handle object) {
|
| }
|
|
|
|
|
| +DART_EXPORT bool Dart_IsByteArrayExternal(Dart_Handle object) {
|
| + return RawObject::IsExternalByteArrayClassId(Api::ClassId(object));
|
| +}
|
| +
|
| +
|
| DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) {
|
| Isolate* isolate = Isolate::Current();
|
| DARTSCOPE(isolate);
|
| @@ -2194,6 +2197,23 @@ DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data,
|
| }
|
|
|
|
|
| +DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetData(Dart_Handle object,
|
| + void** data) {
|
| + Isolate* isolate = Isolate::Current();
|
| + DARTSCOPE(isolate);
|
| + const ExternalUint8Array& array =
|
| + Api::UnwrapExternalUint8ArrayHandle(isolate, object);
|
| + if (array.IsNull()) {
|
| + RETURN_TYPE_ERROR(isolate, object, ExternalUint8Array);
|
| + }
|
| + if (data == NULL) {
|
| + RETURN_NULL_ERROR(data);
|
| + }
|
| + *data = array.GetData();
|
| + return Api::Success(isolate);
|
| +}
|
| +
|
| +
|
| DART_EXPORT Dart_Handle Dart_ExternalByteArrayGetPeer(Dart_Handle object,
|
| void** peer) {
|
| Isolate* isolate = Isolate::Current();
|
|
|