From ffb4f0f812b0ccc37ae759ef8f42fc9c61d36637 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 8 Apr 2025 15:40:15 -0500 Subject: [PATCH] refactor: use v8::True(isolate) and v8::False(isolate) (#46571) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- shell/common/gin_helper/callback.cc | 3 +-- shell/common/gin_helper/event_emitter_caller.cc | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/shell/common/gin_helper/callback.cc b/shell/common/gin_helper/callback.cc index cd5a0a0952e6..b5342ebcb723 100644 --- a/shell/common/gin_helper/callback.cc +++ b/shell/common/gin_helper/callback.cc @@ -54,8 +54,7 @@ void CallTranslator(v8::Local external, args->ThrowTypeError("One-time callback was called more than once"); return; } else { - state->Set(context, called_symbol, v8::Boolean::New(isolate, true)) - .ToChecked(); + state->Set(context, called_symbol, v8::True(isolate)).ToChecked(); } } diff --git a/shell/common/gin_helper/event_emitter_caller.cc b/shell/common/gin_helper/event_emitter_caller.cc index 360c84bebffc..cc10c742a653 100644 --- a/shell/common/gin_helper/event_emitter_caller.cc +++ b/shell/common/gin_helper/event_emitter_caller.cc @@ -18,7 +18,7 @@ v8::Local CallMethodWithArgs( // CallbackScope and MakeCallback both require an active node::Environment if (!node::Environment::GetCurrent(isolate)) - return handle_scope.Escape(v8::Boolean::New(isolate, false)); + return handle_scope.Escape(v8::False(isolate)); node::CallbackScope callback_scope{isolate, v8::Object::New(isolate), node::async_context{0, 0}}; @@ -39,7 +39,7 @@ v8::Local CallMethodWithArgs( if (v8::Local localRet; ret.ToLocal(&localRet)) return handle_scope.Escape(localRet); - return handle_scope.Escape(v8::Boolean::New(isolate, false)); + return handle_scope.Escape(v8::False(isolate)); } } // namespace gin_helper::internal