From 2699f8c860084565a8b3748b3fdf1ebba204f3f7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 5 Mar 2019 23:03:24 +0100 Subject: 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 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Joyee Cheung --- src/api/environment.cc | 5 +---- src/api/hooks.cc | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'src/api') diff --git a/src/api/environment.cc b/src/api/environment.cc index cd3e3aefc2..b7a629340d 100644 --- a/src/api/environment.cc +++ b/src/api/environment.cc @@ -23,7 +23,6 @@ using v8::MaybeLocal; using v8::Message; using v8::MicrotasksPolicy; using v8::ObjectTemplate; -using v8::SealHandleScope; using v8::String; using v8::Value; @@ -35,9 +34,7 @@ static bool AllowWasmCodeGenerationCallback(Local context, } static bool ShouldAbortOnUncaughtException(Isolate* isolate) { -#ifdef DEBUG - SealHandleScope scope(isolate); -#endif + DebugSealHandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); return env != nullptr && (env->is_main_thread() || !env->is_stopping_worker()) && diff --git a/src/api/hooks.cc b/src/api/hooks.cc index aa647778d5..4663df43a6 100644 --- a/src/api/hooks.cc +++ b/src/api/hooks.cc @@ -1,5 +1,5 @@ #include "env-inl.h" -#include "node.h" +#include "node_internals.h" #include "node_process.h" #include "async_wrap.h" @@ -11,7 +11,6 @@ using v8::Integer; using v8::Isolate; using v8::Local; using v8::Object; -using v8::SealHandleScope; using v8::String; using v8::Value; using v8::NewStringType; @@ -116,9 +115,7 @@ async_context EmitAsyncInit(Isolate* isolate, Local resource, Local name, async_id trigger_async_id) { -#ifdef DEBUG - SealHandleScope handle_scope(isolate); -#endif + DebugSealHandleScope handle_scope(isolate); Environment* env = Environment::GetCurrent(isolate); CHECK_NOT_NULL(env); -- cgit v1.2.3