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 <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
addaleax authored and codebytere committed May 11, 2020
1 parent cf03fe5 commit 3de9dd9
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
{}

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

Expand Down

0 comments on commit 3de9dd9

Please sign in to comment.