Chromium Code Reviews| 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, |