Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: isolate->Dispose() order consistency
Browse files Browse the repository at this point in the history
PR-URL: #30181
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: David Carlier <devnexen@gmail.com>
codebytere authored and targos committed Nov 10, 2019

Verified

This commit was signed with the committer’s verified signature.
targos Michaël Zasso
1 parent 9003881 commit 7b3baab
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
@@ -267,10 +267,11 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
// This function may only be called once per `Isolate`.
virtual void RegisterIsolate(v8::Isolate* isolate,
struct uv_loop_s* loop) = 0;
// This needs to be called right before calling `Isolate::Dispose()`.

// This function may only be called once per `Isolate`, and discard any
// pending delayed tasks scheduled for that isolate.
virtual void UnregisterIsolate(v8::Isolate* isolate) = 0;

// The platform should call the passed function once all state associated
// with the given isolate has been cleaned up. This can, but does not have to,
// happen asynchronously.
2 changes: 1 addition & 1 deletion src/node_worker.cc
Original file line number Diff line number Diff line change
@@ -155,9 +155,9 @@ class WorkerThreadData {
w_->platform_->AddIsolateFinishedCallback(isolate, [](void* data) {
*static_cast<bool*>(data) = true;
}, &platform_finished);
w_->platform_->UnregisterIsolate(isolate);

isolate->Dispose();
w_->platform_->UnregisterIsolate(isolate);

// Wait until the platform has cleaned up all relevant resources.
while (!platform_finished)

0 comments on commit 7b3baab

Please sign in to comment.