fix: remove catch-all HandleScope (#22531)
This commit is contained in:
parent
4bca5205bb
commit
19314d3caf
21 changed files with 131 additions and 75 deletions
|
@ -55,13 +55,16 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
|
|||
public:
|
||||
// Mark the JS object as destroyed.
|
||||
void MarkDestroyed() {
|
||||
v8::HandleScope scope(gin_helper::Wrappable<T>::isolate());
|
||||
v8::Local<v8::Object> wrapper = gin_helper::Wrappable<T>::GetWrapper();
|
||||
if (!wrapper.IsEmpty()) {
|
||||
wrapper->SetAlignedPointerInInternalField(0, nullptr);
|
||||
gin_helper::WrappableBase::wrapper_.ClearWeak();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsDestroyed() {
|
||||
v8::HandleScope scope(gin_helper::Wrappable<T>::isolate());
|
||||
v8::Local<v8::Object> wrapper = gin_helper::Wrappable<T>::GetWrapper();
|
||||
return wrapper->InternalFieldCount() == 0 ||
|
||||
wrapper->GetAlignedPointerFromInternalField(0) == nullptr;
|
||||
|
@ -72,6 +75,7 @@ class TrackableObject : public TrackableObjectBase, public EventEmitter<T> {
|
|||
if (!weak_map_)
|
||||
return nullptr;
|
||||
|
||||
v8::HandleScope scope(isolate);
|
||||
v8::MaybeLocal<v8::Object> object = weak_map_->Get(isolate, id);
|
||||
if (object.IsEmpty())
|
||||
return nullptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue