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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 16968006: Add Dart_Allocate to the C++ API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 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
« runtime/include/dart_api.h ('K') | « runtime/include/dart_api.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index 176407caae7a6dd0e8a6775f9733a5fd1846a192..4714bbf349d287ae19cd3700ad6a986d74f3461b 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -2818,6 +2818,23 @@ DART_EXPORT Dart_Handle Dart_New(Dart_Handle clazz,
}
+DART_EXPORT Dart_Handle Dart_Allocate(Dart_Handle clazz) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ CHECK_CALLBACK_STATE(isolate);
+ Object& result = Object::Handle(isolate);
siva 2013/06/18 00:52:14 result doesn't seem to be used at all.
+
+ // Get the class to instantiate.
+ Class& cls =
+ Class::Handle(isolate, Api::UnwrapClassHandle(isolate, clazz).raw());
siva 2013/06/18 00:52:14 const Class& cls = Api::UnwrapClassHandle(isolate,
+ if (cls.IsNull()) {
+ RETURN_TYPE_ERROR(isolate, clazz, Class);
+ }
+
+ return Api::NewHandle(isolate, Instance::New(cls));
+}
siva 2013/06/18 00:52:14 We would also need a test for this in dart_api_imp
vsm 2013/06/19 14:55:12 I rewrote this code to also accept Types, and I ad
+
+
DART_EXPORT Dart_Handle Dart_Invoke(Dart_Handle target,
Dart_Handle name,
int number_of_arguments,
« runtime/include/dart_api.h ('K') | « runtime/include/dart_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698