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 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1863 RawObject::IsTypedDataViewClassId(cid); | 1863 RawObject::IsTypedDataViewClassId(cid); |
1864 } | 1864 } |
1865 | 1865 |
1866 | 1866 |
1867 DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle handle) { | 1867 DART_EXPORT bool Dart_IsByteBuffer(Dart_Handle handle) { |
1868 TRACE_API_CALL(CURRENT_FUNC); | 1868 TRACE_API_CALL(CURRENT_FUNC); |
1869 return Api::ClassId(handle) == kByteBufferCid; | 1869 return Api::ClassId(handle) == kByteBufferCid; |
1870 } | 1870 } |
1871 | 1871 |
1872 | 1872 |
1873 DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) { | |
1874 TRACE_API_CALL(CURRENT_FUNC); | |
1875 Isolate* isolate = Isolate::Current(); | |
1876 DARTSCOPE(isolate); | |
1877 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | |
1878 if (obj.IsInstance()) { | |
siva
2014/09/19 17:38:35
ReusableObjectHandleScope reused_obj_handle(isolat
rmacnak
2014/09/19 21:32:02
Trips the assert as the reusable handle is used in
siva
2014/09/19 21:59:37
In that case you could restructure it as:
Class o
| |
1879 const Library& core_lib = Library::Handle(Library::AsyncLibrary()); | |
siva
2014/09/19 17:38:35
replace core_lib with async_lib for the variable n
rmacnak
2014/09/19 21:32:03
Done.
| |
1880 const Class& future_class = | |
1881 Class::Handle(core_lib.LookupClass(Symbols::Future())); | |
siva
2014/09/19 17:38:35
Class::Handle(isolate, ....);
rmacnak
2014/09/19 21:32:02
Done.
| |
1882 ASSERT(!future_class.IsNull()); | |
1883 const Class& obj_class = Class::Handle(isolate, obj.clazz()); | |
1884 Error& malformed_type_error = Error::Handle(isolate); | |
1885 bool is_future = obj_class.IsSubtypeOf(TypeArguments::Handle(isolate), | |
siva
2014/09/19 17:38:36
IsSubTypeOf(Object::null_type_arguments(),
rmacnak
2014/09/19 21:32:02
Done. (And two other occurrences in this file.)
| |
1886 future_class, | |
1887 TypeArguments::Handle(isolate), | |
1888 &malformed_type_error); | |
1889 ASSERT(malformed_type_error.IsNull()); // Type is a raw Future. | |
1890 return is_future; | |
1891 } | |
1892 return false; | |
1893 } | |
1894 | |
1895 | |
1873 // --- Instances ---- | 1896 // --- Instances ---- |
1874 | 1897 |
1875 DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance) { | 1898 DART_EXPORT Dart_Handle Dart_InstanceGetType(Dart_Handle instance) { |
1876 Isolate* isolate = Isolate::Current(); | 1899 Isolate* isolate = Isolate::Current(); |
1877 DARTSCOPE(isolate); | 1900 DARTSCOPE(isolate); |
1878 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(instance)); | 1901 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(instance)); |
1879 if (obj.IsNull()) { | 1902 if (obj.IsNull()) { |
1880 return Api::NewHandle(isolate, isolate->object_store()->null_type()); | 1903 return Api::NewHandle(isolate, isolate->object_store()->null_type()); |
1881 } | 1904 } |
1882 if (!obj.IsInstance()) { | 1905 if (!obj.IsInstance()) { |
(...skipping 3501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5384 | 5407 |
5385 | 5408 |
5386 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5409 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5387 const char* name, | 5410 const char* name, |
5388 Dart_ServiceRequestCallback callback, | 5411 Dart_ServiceRequestCallback callback, |
5389 void* user_data) { | 5412 void* user_data) { |
5390 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5413 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5391 } | 5414 } |
5392 | 5415 |
5393 } // namespace dart | 5416 } // namespace dart |
OLD | NEW |