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 3969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3980 } | 3980 } |
3981 | 3981 |
3982 | 3982 |
3983 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, | 3983 DART_EXPORT Dart_Handle Dart_InvokeClosure(Dart_Handle closure, |
3984 int number_of_arguments, | 3984 int number_of_arguments, |
3985 Dart_Handle* arguments) { | 3985 Dart_Handle* arguments) { |
3986 Isolate* isolate = Isolate::Current(); | 3986 Isolate* isolate = Isolate::Current(); |
3987 DARTSCOPE(isolate); | 3987 DARTSCOPE(isolate); |
3988 CHECK_CALLBACK_STATE(isolate); | 3988 CHECK_CALLBACK_STATE(isolate); |
3989 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); | 3989 const Instance& closure_obj = Api::UnwrapInstanceHandle(isolate, closure); |
3990 if (closure_obj.IsNull() || !closure_obj.IsCallable(NULL, NULL)) { | 3990 if (closure_obj.IsNull() || !closure_obj.IsCallable(NULL)) { |
3991 RETURN_TYPE_ERROR(isolate, closure, Instance); | 3991 RETURN_TYPE_ERROR(isolate, closure, Instance); |
3992 } | 3992 } |
3993 if (number_of_arguments < 0) { | 3993 if (number_of_arguments < 0) { |
3994 return Api::NewError( | 3994 return Api::NewError( |
3995 "%s expects argument 'number_of_arguments' to be non-negative.", | 3995 "%s expects argument 'number_of_arguments' to be non-negative.", |
3996 CURRENT_FUNC); | 3996 CURRENT_FUNC); |
3997 } | 3997 } |
3998 | 3998 |
3999 // Set up arguments to include the closure as the first argument. | 3999 // Set up arguments to include the closure as the first argument. |
4000 const Array& args = Array::Handle(isolate, | 4000 const Array& args = Array::Handle(isolate, |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5413 | 5413 |
5414 | 5414 |
5415 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5415 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
5416 const char* name, | 5416 const char* name, |
5417 Dart_ServiceRequestCallback callback, | 5417 Dart_ServiceRequestCallback callback, |
5418 void* user_data) { | 5418 void* user_data) { |
5419 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5419 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
5420 } | 5420 } |
5421 | 5421 |
5422 } // namespace dart | 5422 } // namespace dart |
OLD | NEW |