Chromium Code Reviews| Index: runtime/vm/dart_api_impl.cc |
| diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc |
| index d7c58186dc713586dc432186815d607d64e1be4d..a7660389d9e5ad7e879812541f31c25e47b92c17 100644 |
| --- a/runtime/vm/dart_api_impl.cc |
| +++ b/runtime/vm/dart_api_impl.cc |
| @@ -493,23 +493,32 @@ void Api::InitOnce() { |
| } |
| +static Dart_Handle InitNewReadOnlyApiHandle(RawObject* raw) { |
| + ASSERT(raw->IsVMHeapObject()); |
| + LocalHandle* ref = Dart::AllocateReadOnlyApiHandle(); |
| + ref->set_raw(raw); |
| + return reinterpret_cast<Dart_Handle>(ref); |
|
Ivan Posva
2015/06/17 16:58:57
Not sure how often we need to make LocalHandles in
|
| +} |
| + |
| + |
| void Api::InitHandles() { |
| Isolate* isolate = Isolate::Current(); |
| ASSERT(isolate != NULL); |
| ASSERT(isolate == Dart::vm_isolate()); |
| ApiState* state = isolate->api_state(); |
| ASSERT(state != NULL); |
| + |
| ASSERT(true_handle_ == NULL); |
| - true_handle_ = Api::InitNewHandle(isolate, Bool::True().raw()); |
| + true_handle_ = InitNewReadOnlyApiHandle(Bool::True().raw()); |
| ASSERT(false_handle_ == NULL); |
| - false_handle_ = Api::InitNewHandle(isolate, Bool::False().raw()); |
| + false_handle_ = InitNewReadOnlyApiHandle(Bool::False().raw()); |
| ASSERT(null_handle_ == NULL); |
| - null_handle_ = Api::InitNewHandle(isolate, Object::null()); |
| + null_handle_ = InitNewReadOnlyApiHandle(Object::null()); |
| ASSERT(empty_string_handle_ == NULL); |
| - empty_string_handle_ = Api::InitNewHandle(isolate, Symbols::Empty().raw()); |
| + empty_string_handle_ = InitNewReadOnlyApiHandle(Symbols::Empty().raw()); |
| } |