diff --git a/src/node_internals.h b/src/node_internals.h index fa3ba022fe7e23..70750cc87179ca 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -243,9 +243,9 @@ class InternalCallbackScope { class DebugSealHandleScope { public: - explicit inline DebugSealHandleScope(v8::Isolate* isolate) + explicit inline DebugSealHandleScope(v8::Isolate* isolate = nullptr) #ifdef DEBUG - : actual_scope_(isolate) + : actual_scope_(isolate != nullptr ? isolate : v8::Isolate::GetCurrent()) #endif {} diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index 9660cc386cef82..149f542d841607 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -92,29 +92,29 @@ void StreamResource::RemoveStreamListener(StreamListener* listener) { } uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; return listener_->OnStreamAlloc(suggested_size); } void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; if (nread > 0) bytes_read_ += static_cast(nread); listener_->OnStreamRead(nread, buf); } void StreamResource::EmitAfterWrite(WriteWrap* w, int status) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamAfterWrite(w, status); } void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamAfterShutdown(w, status); } void StreamResource::EmitWantsWrite(size_t suggested_size) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamWantsWrite(suggested_size); }