0

[V8] Reset IsolateData only after disposing the Isolate

Calling Isolate::Dispose before resetting the isolate_data
makes sure all threads which might access PerIsolateData are finished.

Bug: chromium:1278990
Change-Id: Icdf62f583b574bc83b7dacd3444ea618f395f9fc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3341061
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/main@{#955784}
This commit is contained in:
Victor Gomes
2022-01-05 18:19:42 +00:00
committed by Chromium LUCI CQ
parent a5b5d7cd26
commit 955595bcb8
2 changed files with 4 additions and 4 deletions

@ -106,8 +106,10 @@ IsolateHolder::IsolateHolder(
IsolateHolder::~IsolateHolder() {
isolate_memory_dump_provider_.reset();
isolate_data_.reset();
// Calling Isolate::Dispose makes sure all threads which might access
// PerIsolateData are finished.
isolate_->Dispose();
isolate_data_.reset();
isolate_ = nullptr;
}

@ -42,9 +42,7 @@ PerIsolateData::PerIsolateData(
}
}
PerIsolateData::~PerIsolateData() {
isolate_->SetData(kEmbedderNativeGin, NULL);
}
PerIsolateData::~PerIsolateData() = default;
PerIsolateData* PerIsolateData::From(Isolate* isolate) {
return static_cast<PerIsolateData*>(isolate->GetData(kEmbedderNativeGin));