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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2640573003: Resolution for issue #5092: Unit test handle checks consider dangling handles to be valid. (Closed)
Patch Set: Removed Dart API entry for IsValid. Created 3 years, 11 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/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_api_impl.cc
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index ad6daba1a2ddd0a6b6740cc892f3deaf2dad6e28..9a4f823b171ea40d4637d9068fbaa340bcc807c3 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()->IsActivePersistentHandle(
bkonyi 2017/01/20 23:07:11 I added IsActive(Weak)PersistentHandle to check if
+ reinterpret_cast<Dart_PersistentHandle>(handle)) ||
+ isolate->api_state()->IsActiveWeakPersistentHandle(
+ 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();
« no previous file with comments | « runtime/vm/dart_api_impl.h ('k') | runtime/vm/dart_api_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698