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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 2281193002: Treat background finalization as another GC task so it won't run in parallel with the marker. (Closed)
Patch Set: review Created 4 years, 4 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 | « no previous file | runtime/vm/dart_api_impl_test.cc » ('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 e64c399fc4d914d842415daf668676a053903f5d..560b600dc8dcebc0570052d82638731441aed301 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -730,7 +730,7 @@ FinalizablePersistentHandle* FinalizablePersistentHandle::Cast(
void FinalizablePersistentHandle::Finalize(
Isolate* isolate, FinalizablePersistentHandle* handle) {
if (!handle->raw()->IsHeapObject()) {
- return;
+ return; // Free handle.
}
Dart_WeakPersistentHandleFinalizer callback = handle->callback();
ASSERT(callback != NULL);
@@ -1034,6 +1034,9 @@ static Dart_WeakPersistentHandle AllocateFinalizableHandle(
REUSABLE_OBJECT_HANDLESCOPE(thread);
Object& ref = thread->ObjectHandle();
ref = Api::UnwrapHandle(object);
+ if (!ref.raw()->IsHeapObject()) {
+ return NULL;
+ }
FinalizablePersistentHandle* finalizable_ref =
FinalizablePersistentHandle::New(thread->isolate(),
ref,
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698