diff --git a/src/node_internals.h b/src/node_internals.h index 9f4f3337172f1b..c1555b312e2f22 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -246,9 +246,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 41eeb1e0ef5710..ef7a5e4c7a87f2 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -113,29 +113,29 @@ inline void StreamResource::RemoveStreamListener(StreamListener* listener) { } inline uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; return listener_->OnStreamAlloc(suggested_size); } inline 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); } inline void StreamResource::EmitAfterWrite(WriteWrap* w, int status) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamAfterWrite(w, status); } inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamAfterShutdown(w, status); } inline void StreamResource::EmitWantsWrite(size_t suggested_size) { - DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); + DebugSealHandleScope seal_handle_scope; listener_->OnStreamWantsWrite(suggested_size); }