OLD | NEW |
---|---|
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
(...skipping 3223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3234 return GetType(class_id); | 3234 return GetType(class_id); |
3235 } | 3235 } |
3236 return Dart_TypedData_kInvalid; | 3236 return Dart_TypedData_kInvalid; |
3237 } | 3237 } |
3238 | 3238 |
3239 | 3239 |
3240 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData( | 3240 DART_EXPORT Dart_TypedData_Type Dart_GetTypeOfExternalTypedData( |
3241 Dart_Handle object) { | 3241 Dart_Handle object) { |
3242 TRACE_API_CALL(CURRENT_FUNC); | 3242 TRACE_API_CALL(CURRENT_FUNC); |
3243 intptr_t class_id = Api::ClassId(object); | 3243 intptr_t class_id = Api::ClassId(object); |
3244 if (RawObject::IsExternalTypedDataClassId(class_id) || | 3244 if (RawObject::IsExternalTypedDataClassId(class_id)) { |
3245 RawObject::IsTypedDataViewClassId(class_id)) { | |
3246 return GetType(class_id); | 3245 return GetType(class_id); |
3247 } | 3246 } |
3247 if (RawObject::IsTypedDataViewClassId(class_id)) { | |
3248 // Check if data object of the view is external. | |
3249 Isolate* isolate = Isolate::Current(); | |
3250 const Instance& view_obj = Api::UnwrapInstanceHandle(isolate, object); | |
3251 ASSERT(!view_obj.IsNull()); | |
3252 const Instance& data_obj = Instance::Handle(TypedDataView::Data(view_obj)); | |
siva
2015/06/12 16:27:06
Since isolate is available why not use
Instance::H
| |
3253 if (ExternalTypedData::IsExternalTypedData(data_obj)) { | |
3254 return GetType(class_id); | |
3255 } | |
3256 } | |
3248 return Dart_TypedData_kInvalid; | 3257 return Dart_TypedData_kInvalid; |
3249 } | 3258 } |
3250 | 3259 |
3251 | 3260 |
3252 static RawObject* GetByteDataConstructor(Isolate* isolate, | 3261 static RawObject* GetByteDataConstructor(Isolate* isolate, |
3253 const String& constructor_name, | 3262 const String& constructor_name, |
3254 intptr_t num_args) { | 3263 intptr_t num_args) { |
3255 const Library& lib = | 3264 const Library& lib = |
3256 Library::Handle(isolate->object_store()->typed_data_library()); | 3265 Library::Handle(isolate->object_store()->typed_data_library()); |
3257 ASSERT(!lib.IsNull()); | 3266 ASSERT(!lib.IsNull()); |
(...skipping 2394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5652 | 5661 |
5653 | 5662 |
5654 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5663 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5655 const char* name, | 5664 const char* name, |
5656 Dart_ServiceRequestCallback callback, | 5665 Dart_ServiceRequestCallback callback, |
5657 void* user_data) { | 5666 void* user_data) { |
5658 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5667 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5659 } | 5668 } |
5660 | 5669 |
5661 } // namespace dart | 5670 } // namespace dart |
OLD | NEW |