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 22e23911615cecd9d72dcd545b018d2983ff3b1b..e7017cfddfefce0e810db8140fb9521bb33f7486 100644 |
| --- a/runtime/vm/dart_api_impl.cc |
| +++ b/runtime/vm/dart_api_impl.cc |
| @@ -534,6 +534,22 @@ Dart_Handle Api::AcquiredError(Isolate* isolate) { |
| } |
| +bool Api::IsValid(Dart_Handle handle) { |
| + Isolate* isolate = Isolate::Current(); |
| + CHECK_ISOLATE(isolate); |
| + |
| + // Check against all of the handles in the current isolate as well as the |
| + // read-only handles. |
| + return isolate->thread_registry()->IsValidHandle(handle) || |
| + isolate->api_state()->IsValidPersistentHandle( |
| + reinterpret_cast<Dart_PersistentHandle>(handle)) || |
| + isolate->api_state()->IsValidWeakPersistentHandle( |
| + reinterpret_cast<Dart_WeakPersistentHandle>(handle)) || |
| + Dart::IsReadOnlyApiHandle(handle) || |
| + Dart::IsReadOnlyHandle(reinterpret_cast<uword>(handle)); |
| +} |
| + |
| + |
| ApiLocalScope* Api::TopScope(Thread* thread) { |
| ASSERT(thread != NULL); |
| ApiLocalScope* scope = thread->api_top_scope(); |
| @@ -759,6 +775,11 @@ void FinalizablePersistentHandle::Finalize( |
| // --- Handles --- |
| +DART_EXPORT bool Dart_IsValid(Dart_Handle handle) { |
| + return Api::IsValid(handle); |
| +} |
|
siva
2017/01/20 17:40:03
Not needed as you have dropped it from the API.
bkonyi
2017/01/20 23:07:11
Done.
|
| + |
| + |
| DART_EXPORT bool Dart_IsError(Dart_Handle handle) { |
| return Api::IsError(handle); |
| } |