Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| =================================================================== |
| --- runtime/vm/dart_api_impl.cc (revision 19851) |
| +++ runtime/vm/dart_api_impl.cc (working copy) |
| @@ -4,6 +4,7 @@ |
| #include "include/dart_api.h" |
| +#include "platform/assert.h" |
| #include "vm/bigint_operations.h" |
| #include "vm/class_finalizer.h" |
| #include "vm/compiler.h" |
| @@ -4192,20 +4193,19 @@ |
| } |
| -// This function has friend access to SetReturnUnsafe. |
| -void SetReturnValueHelper(Dart_NativeArguments args, Dart_Handle retval) { |
| +DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, |
| + Dart_Handle retval) { |
| + const Object& ret_obj = Object::Handle(Api::UnwrapHandle(retval)); |
| + if (!ret_obj.IsNull() && !ret_obj.IsInstance()) { |
| + FATAL1("Return value check failed: saw %s expected a dart Instance.", |
|
Ivan Posva
2013/03/12 16:30:36
How about wrapping the %s in '?
siva
2013/03/13 13:55:07
Done.
|
| + ret_obj.ToCString()); |
| + } |
| NoGCScope no_gc_scope; |
| NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); |
| - arguments->SetReturnUnsafe(Api::UnwrapHandle(retval)); |
| + arguments->SetReturn(ret_obj); |
| } |
| -DART_EXPORT void Dart_SetReturnValue(Dart_NativeArguments args, |
| - Dart_Handle retval) { |
| - SetReturnValueHelper(args, retval); |
| -} |
| - |
| - |
| // --- Scripts and Libraries --- |