refactor: avoid deprecated v8::Context::GetIsolate() calls (pt 2) (#47896)

* refactor: add a v8::Isolate* arg to Constructible::GetConstructor()

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: add a v8::Isolate* arg to NodeBindings::Initialize()

This is needed for the GetConstructor() call

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid v8::Context::GetIsolate() call in GetIpcObject() by taking it as an arg

Co-authored-by: Charles Kerr <charles@charleskerr.com>

* refactor: avoid v8::Context::GetIsolate() call in ipc_native::EmitIPCEvent() by taking it as an arg

Co-authored-by: Charles Kerr <charles@charleskerr.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot]
2025-07-29 10:34:18 -04:00
committed by GitHub
parent edccb0a7ea
commit e1e12318e2
18 changed files with 42 additions and 36 deletions

View File

@@ -122,9 +122,10 @@ void NodeService::Initialize(
js_env_ = std::make_unique<JavascriptEnvironment>(node_bindings_->uv_loop());
v8::HandleScope scope(js_env_->isolate());
v8::Isolate* const isolate = js_env_->isolate();
v8::HandleScope scope{isolate};
node_bindings_->Initialize(js_env_->isolate()->GetCurrentContext());
node_bindings_->Initialize(isolate, isolate->GetCurrentContext());
// Append program path for process.argv0
auto program = base::CommandLine::ForCurrentProcess()->GetProgram();
@@ -136,9 +137,9 @@ void NodeService::Initialize(
// Create the global environment.
node_env_ = node_bindings_->CreateEnvironment(
js_env_->isolate(), js_env_->isolate()->GetCurrentContext(),
js_env_->platform(), js_env_->max_young_generation_size_in_bytes(),
params->args, params->exec_args);
isolate, isolate->GetCurrentContext(), js_env_->platform(),
js_env_->max_young_generation_size_in_bytes(), params->args,
params->exec_args);
// Override the default handler set by NodeBindings.
node_env_->isolate()->SetFatalErrorHandler(V8FatalErrorCallback);