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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 116473004: Add Dart API method Dart_SetPersistentHandle to enable setting the value of (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 12 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 | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('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 31439)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -578,6 +578,25 @@
return reinterpret_cast<Dart_PersistentHandle>(new_ref);
}
+
+DART_EXPORT Dart_Handle Dart_SetPersistentHandle(Dart_PersistentHandle obj1,
+ Dart_Handle obj2) {
+ Isolate* isolate = Isolate::Current();
+ DARTSCOPE(isolate);
+ ApiState* state = isolate->api_state();
+ ASSERT(state != NULL);
+ if (!state->IsValidPersistentHandle(obj1)) {
Ivan Posva 2014/01/03 18:21:21 In other places we just assert on this instead of
siva 2014/01/03 18:33:49 Done.
+ return Api::NewError(
+ "%s expects argument 'obj1' to be a persistent handle.",
+ CURRENT_FUNC);
+ }
+ const Object& obj2_ref = Object::Handle(isolate, Api::UnwrapHandle(obj2));
+ PersistentHandle* obj1_ref = Api::UnwrapAsPersistentHandle(obj1);
+ obj1_ref->set_raw(obj2_ref);
+ return Api::Success();
Ivan Posva 2014/01/03 18:21:21 Then you can also change the signature of the func
siva 2014/01/03 18:33:49 Done.
+}
+
+
static Dart_WeakPersistentHandle AllocateFinalizableHandle(
Isolate* isolate,
FinalizablePersistentHandles* handles,
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698