Skip to content

Commit 3de9dd9

Browse files
addaleaxcodebytere
authored andcommitted
src: remove unnecessary Isolate::GetCurrent() calls
These calls are unnecessary in Release mode but would still have been included, so move them to the `DebugSealHandleScope` constructor. PR-URL: #33298 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent cf03fe5 commit 3de9dd9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/node_internals.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ class InternalCallbackScope {
243243

244244
class DebugSealHandleScope {
245245
public:
246-
explicit inline DebugSealHandleScope(v8::Isolate* isolate)
246+
explicit inline DebugSealHandleScope(v8::Isolate* isolate = nullptr)
247247
#ifdef DEBUG
248-
: actual_scope_(isolate)
248+
: actual_scope_(isolate != nullptr ? isolate : v8::Isolate::GetCurrent())
249249
#endif
250250
{}
251251

src/stream_base-inl.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -92,29 +92,29 @@ void StreamResource::RemoveStreamListener(StreamListener* listener) {
9292
}
9393

9494
uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) {
95-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
95+
DebugSealHandleScope seal_handle_scope;
9696
return listener_->OnStreamAlloc(suggested_size);
9797
}
9898

9999
void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) {
100-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
100+
DebugSealHandleScope seal_handle_scope;
101101
if (nread > 0)
102102
bytes_read_ += static_cast<uint64_t>(nread);
103103
listener_->OnStreamRead(nread, buf);
104104
}
105105

106106
void StreamResource::EmitAfterWrite(WriteWrap* w, int status) {
107-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
107+
DebugSealHandleScope seal_handle_scope;
108108
listener_->OnStreamAfterWrite(w, status);
109109
}
110110

111111
void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) {
112-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
112+
DebugSealHandleScope seal_handle_scope;
113113
listener_->OnStreamAfterShutdown(w, status);
114114
}
115115

116116
void StreamResource::EmitWantsWrite(size_t suggested_size) {
117-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
117+
DebugSealHandleScope seal_handle_scope;
118118
listener_->OnStreamWantsWrite(suggested_size);
119119
}
120120

0 commit comments

Comments
 (0)