-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
src: refactor weakref cleanup #30198
Conversation
7aa2a72
to
1aff25f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the motivation here? I feel like this is a step in an odd direction, and I'd still prefer to run these as tasks on an uv_async_t rather than doing so using the miceotask queue or running at the end of the callback scope...
|
||
void HostCleanupFinalizationGroupMicrotask(void* data) { | ||
FinalizationGroupCleanupTask* t = | ||
reinterpret_cast<FinalizationGroupCleanupTask*>(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use static_cast
here?
env->RegisterFinalizationGroupForCleanup(group); | ||
env->isolate()->EnqueueMicrotask( | ||
HostCleanupFinalizationGroupMicrotask, | ||
new FinalizationGroupCleanupTask(env, group)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this misses a corresponding delete
?
@addaleax ClearKeptObjects is in the correct place either way. Why would a uv_async_t be preferable for the finalization cleanup? |
@devsnek I still think it’s preferable to run these callbacks after GC without an unbounded delay, like whatwg/html#4571 suggests it for HTML. |
Hm … ping @devsnek? I’m currently running into the “Cannot create a handle without a HandleScope” crash :) |
Schedule a task on the main event loop, similar to what the HTML spec recommends for browsers. Alternative to nodejs#30198
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes