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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 1182123002: Fix bug in Dart_GetTypeOfExternalTypedData. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comment Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698