Skip to content

Commit b630079

Browse files
addaleaxcodebytere
authored andcommittedJun 7, 2020
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 <daniel.bevenius@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
1 parent cdd7d3a commit b630079

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
@@ -246,9 +246,9 @@ class InternalCallbackScope {
246246

247247
class DebugSealHandleScope {
248248
public:
249-
explicit inline DebugSealHandleScope(v8::Isolate* isolate)
249+
explicit inline DebugSealHandleScope(v8::Isolate* isolate = nullptr)
250250
#ifdef DEBUG
251-
: actual_scope_(isolate)
251+
: actual_scope_(isolate != nullptr ? isolate : v8::Isolate::GetCurrent())
252252
#endif
253253
{}
254254

‎src/stream_base-inl.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -113,29 +113,29 @@ inline void StreamResource::RemoveStreamListener(StreamListener* listener) {
113113
}
114114

115115
inline uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) {
116-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
116+
DebugSealHandleScope seal_handle_scope;
117117
return listener_->OnStreamAlloc(suggested_size);
118118
}
119119

120120
inline void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) {
121-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
121+
DebugSealHandleScope seal_handle_scope;
122122
if (nread > 0)
123123
bytes_read_ += static_cast<uint64_t>(nread);
124124
listener_->OnStreamRead(nread, buf);
125125
}
126126

127127
inline void StreamResource::EmitAfterWrite(WriteWrap* w, int status) {
128-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
128+
DebugSealHandleScope seal_handle_scope;
129129
listener_->OnStreamAfterWrite(w, status);
130130
}
131131

132132
inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) {
133-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
133+
DebugSealHandleScope seal_handle_scope;
134134
listener_->OnStreamAfterShutdown(w, status);
135135
}
136136

137137
inline void StreamResource::EmitWantsWrite(size_t suggested_size) {
138-
DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent());
138+
DebugSealHandleScope seal_handle_scope;
139139
listener_->OnStreamWantsWrite(suggested_size);
140140
}
141141

0 commit comments

Comments
 (0)
Please sign in to comment.