diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-03-06 01:03:24 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-09 02:27:29 +0300 |
commit | 2699f8c860084565a8b3748b3fdf1ebba204f3f7 (patch) | |
tree | 35b317504f40d0e3b3a25e5b4205596c41a6b76c /src/stream_base-inl.h | |
parent | c957b0517766729f931a1ef7ab134f75d6a01864 (diff) |
src: merge debug-only `SealHandleScope`s
Instead of repeating the same `#ifdef DEBUG` + `SealHandleScope`
pattern over and over, create an utility that does this for us.
PR-URL: https://github.com/nodejs/node/pull/26459
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/stream_base-inl.h')
-rw-r--r-- | src/stream_base-inl.h | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index f9a67872f90..368dcafe1c3 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -113,39 +113,29 @@ inline void StreamResource::RemoveStreamListener(StreamListener* listener) { } inline uv_buf_t StreamResource::EmitAlloc(size_t suggested_size) { -#ifdef DEBUG - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); -#endif + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); return listener_->OnStreamAlloc(suggested_size); } inline void StreamResource::EmitRead(ssize_t nread, const uv_buf_t& buf) { -#ifdef DEBUG - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); -#endif + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); if (nread > 0) bytes_read_ += static_cast<uint64_t>(nread); listener_->OnStreamRead(nread, buf); } inline void StreamResource::EmitAfterWrite(WriteWrap* w, int status) { -#ifdef DEBUG - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); -#endif + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); listener_->OnStreamAfterWrite(w, status); } inline void StreamResource::EmitAfterShutdown(ShutdownWrap* w, int status) { -#ifdef DEBUG - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); -#endif + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); listener_->OnStreamAfterShutdown(w, status); } inline void StreamResource::EmitWantsWrite(size_t suggested_size) { -#ifdef DEBUG - v8::SealHandleScope handle_scope(v8::Isolate::GetCurrent()); -#endif + DebugSealHandleScope handle_scope(v8::Isolate::GetCurrent()); listener_->OnStreamWantsWrite(suggested_size); } |