Skip to content

Commit

Permalink
src: remove unnecessary Isolate::GetCurrent() calls
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
addaleax authored and codebytere committed Jun 7, 2020
1 parent cdd7d3a commit b630079
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/node_internals.h
Expand Up @@ -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
{}

Expand Down
10 changes: 5 additions & 5 deletions src/stream_base-inl.h
Expand Up @@ -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<uint64_t>(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);
}

Expand Down

0 comments on commit b630079

Please sign in to comment.