summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShelley Vohr <shelley.vohr@gmail.com>2019-10-30 10:52:45 -0700
committerShelley Vohr <shelley.vohr@gmail.com>2019-11-01 14:10:13 -0700
commit312c02d25e90aac1ee087bf3386636e8c81e2a66 (patch)
treee38cc0c788c2a31dac37ee06f1c0f36589272d9c /src
parentd7452b7140929835f4032099106fc9d14e668210 (diff)
downloadandroid-node-v8-312c02d25e90aac1ee087bf3386636e8c81e2a66.tar.gz
android-node-v8-312c02d25e90aac1ee087bf3386636e8c81e2a66.tar.bz2
android-node-v8-312c02d25e90aac1ee087bf3386636e8c81e2a66.zip
src: isolate->Dispose() order consistency
PR-URL: https://github.com/nodejs/node/pull/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>
Diffstat (limited to 'src')
-rw-r--r--src/node.h3
-rw-r--r--src/node_worker.cc2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/node.h b/src/node.h
index 240399d1ed..872e0a811a 100644
--- a/src/node.h
+++ b/src/node.h
@@ -273,10 +273,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.
diff --git a/src/node_worker.cc b/src/node_worker.cc
index 025b5fed49..af79540631 100644
--- a/src/node_worker.cc
+++ b/src/node_worker.cc
@@ -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)