| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
| 6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
| 7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
| 8 | 8 |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 929 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } | 940 } |
| 941 | 941 |
| 942 | 942 |
| 943 static Dart_WeakPersistentHandle AllocateFinalizableHandle( | 943 static Dart_WeakPersistentHandle AllocateFinalizableHandle( |
| 944 Isolate* isolate, | 944 Isolate* isolate, |
| 945 Dart_Handle object, | 945 Dart_Handle object, |
| 946 bool is_prologue, | 946 bool is_prologue, |
| 947 void* peer, | 947 void* peer, |
| 948 intptr_t external_allocation_size, | 948 intptr_t external_allocation_size, |
| 949 Dart_WeakPersistentHandleFinalizer callback) { | 949 Dart_WeakPersistentHandleFinalizer callback) { |
| 950 ApiState* state = isolate->api_state(); | |
| 951 ASSERT(state != NULL); | |
| 952 REUSABLE_OBJECT_HANDLESCOPE(isolate); | 950 REUSABLE_OBJECT_HANDLESCOPE(isolate); |
| 953 Object& ref = isolate->ObjectHandle(); | 951 Object& ref = isolate->ObjectHandle(); |
| 954 ref = Api::UnwrapHandle(object); | 952 ref = Api::UnwrapHandle(object); |
| 955 FinalizablePersistentHandle* finalizable_ref = is_prologue ? | 953 FinalizablePersistentHandle* finalizable_ref = |
| 956 state->prologue_weak_persistent_handles().AllocateHandle() : | 954 FinalizablePersistentHandle::New(isolate, |
| 957 state->weak_persistent_handles().AllocateHandle(); | 955 is_prologue, |
| 958 | 956 ref, |
| 959 finalizable_ref->set_raw(ref); | 957 peer, |
| 960 finalizable_ref->set_peer(peer); | 958 callback, |
| 961 finalizable_ref->set_callback(callback); | 959 external_allocation_size); |
| 962 finalizable_ref->SetExternalSize(external_allocation_size, isolate); | |
| 963 finalizable_ref->SetPrologueWeakPersistent(is_prologue); | |
| 964 return finalizable_ref->apiHandle(); | 960 return finalizable_ref->apiHandle(); |
| 965 } | 961 } |
| 966 | 962 |
| 967 | 963 |
| 968 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( | 964 DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle( |
| 969 Dart_Handle object, | 965 Dart_Handle object, |
| 970 void* peer, | 966 void* peer, |
| 971 intptr_t external_allocation_size, | 967 intptr_t external_allocation_size, |
| 972 Dart_WeakPersistentHandleFinalizer callback) { | 968 Dart_WeakPersistentHandleFinalizer callback) { |
| 973 Isolate* isolate = Isolate::Current(); | 969 Isolate* isolate = Isolate::Current(); |
| (...skipping 4218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5192 | 5188 |
| 5193 | 5189 |
| 5194 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( | 5190 DART_EXPORT void Dart_RegisterRootServiceRequestCallback( |
| 5195 const char* name, | 5191 const char* name, |
| 5196 Dart_ServiceRequestCallback callback, | 5192 Dart_ServiceRequestCallback callback, |
| 5197 void* user_data) { | 5193 void* user_data) { |
| 5198 Service::RegisterRootEmbedderCallback(name, callback, user_data); | 5194 Service::RegisterRootEmbedderCallback(name, callback, user_data); |
| 5199 } | 5195 } |
| 5200 | 5196 |
| 5201 } // namespace dart | 5197 } // namespace dart |
| OLD | NEW |