Index: runtime/vm/dart_api_impl.cc |
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
index cb5d584d94defbb8ce8e76e8412285428fb5cce5..e969b5088c0332c98f9133cc923018fa8fb0ce46 100644 |
--- a/runtime/vm/dart_api_impl.cc |
+++ b/runtime/vm/dart_api_impl.cc |
@@ -3241,10 +3241,20 @@ DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData( |
Dart_Handle object) { |
TRACE_API_CALL(CURRENT_FUNC); |
intptr_t class_id = Api::ClassId(object); |
- if (RawObject::IsExternalTypedDataClassId(class_id) || |
- RawObject::IsTypedDataViewClassId(class_id)) { |
+ if (RawObject::IsExternalTypedDataClassId(class_id)) { |
return GetType(class_id); |
} |
+ if (RawObject::IsTypedDataViewClassId(class_id)) { |
+ // Check if data object of the view is external. |
+ Isolate* isolate = Isolate::Current(); |
+ const Instance& view_obj = Api::UnwrapInstanceHandle(isolate, object); |
+ ASSERT(!view_obj.IsNull()); |
+ const Instance& data_obj = |
+ Instance::Handle(isolate, TypedDataView::Data(view_obj)); |
+ if (ExternalTypedData::IsExternalTypedData(data_obj)) { |
+ return GetType(class_id); |
+ } |
+ } |
return Dart_TypedData_kInvalid; |
} |