Chromium Code Reviews| 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..573ee759228a19331bf94b23751a994cf2ef2c13 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_IsExternalByteArray(Dart_Handle object) { |
| + return RawObject::IsExternalByteArrayClassId(Api::ClassId(object)); |
| +} |
| + |
| + |
| DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) { |
| Isolate* isolate = Isolate::Current(); |
| DARTSCOPE(isolate); |
| @@ -2179,6 +2182,7 @@ DART_EXPORT Dart_Handle Dart_NewByteArray(intptr_t length) { |
| } |
| + |
|
cshapiro
2012/11/01 00:40:19
Remove this addition. Only 2 spaces between defin
Søren Gjesse
2012/11/01 07:46:03
Done.
|
| DART_EXPORT Dart_Handle Dart_NewExternalByteArray(uint8_t* data, |
| intptr_t length, |
| void* peer, |
| @@ -2194,6 +2198,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(); |