Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 12744006: Added check that the object being stored as a return value in the NativeArguments array is a Dart i… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/vm/native_entry.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 19928)
+++ 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.",
+ 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 ---
« no previous file with comments | « no previous file | runtime/vm/native_entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698