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 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 1873 DART_EXPORT bool Dart_IsFuture(Dart_Handle handle) { |
1874 TRACE_API_CALL(CURRENT_FUNC); | 1874 TRACE_API_CALL(CURRENT_FUNC); |
1875 Isolate* isolate = Isolate::Current(); | 1875 Isolate* isolate = Isolate::Current(); |
1876 DARTSCOPE(isolate); | 1876 DARTSCOPE(isolate); |
1877 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); | 1877 const Object& obj = Object::Handle(isolate, Api::UnwrapHandle(handle)); |
1878 if (obj.IsInstance()) { | 1878 if (obj.IsInstance()) { |
1879 const Library& async_lib = | |
1880 Library::Handle(isolate, Library::AsyncLibrary()); | |
1881 const Class& future_class = | 1879 const Class& future_class = |
1882 Class::Handle(isolate, async_lib.LookupClass(Symbols::Future())); | 1880 Class::Handle(isolate->object_store()->future_class()); |
1883 ASSERT(!future_class.IsNull()); | 1881 ASSERT(!future_class.IsNull()); |
1884 const Class& obj_class = Class::Handle(isolate, obj.clazz()); | 1882 const Class& obj_class = Class::Handle(isolate, obj.clazz()); |
1885 Error& malformed_type_error = Error::Handle(isolate); | 1883 Error& malformed_type_error = Error::Handle(isolate); |
1886 bool is_future = obj_class.IsSubtypeOf(Object::null_type_arguments(), | 1884 bool is_future = obj_class.IsSubtypeOf(Object::null_type_arguments(), |
1887 future_class, | 1885 future_class, |
1888 Object::null_type_arguments(), | 1886 Object::null_type_arguments(), |
1889 &malformed_type_error); | 1887 &malformed_type_error); |
1890 ASSERT(malformed_type_error.IsNull()); // Type is a raw Future. | 1888 ASSERT(malformed_type_error.IsNull()); // Type is a raw Future. |
1891 return is_future; | 1889 return is_future; |
1892 } | 1890 } |
(...skipping 3515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5408 | 5406 |
5409 | 5407 |
5410 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5408 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5411 const char* name, | 5409 const char* name, |
5412 Dart_ServiceRequestCallback callback, | 5410 Dart_ServiceRequestCallback callback, |
5413 void* user_data) { | 5411 void* user_data) { |
5414 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5412 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5415 } | 5413 } |
5416 | 5414 |
5417 } // namespace dart | 5415 } // namespace dart |
OLD | NEW |