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

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

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

This is needed for the GetConstructor() call

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

* refactor: avoid v8::Context::GetIsolate() call in ipc_native::EmitIPCEvent() by taking it as an arg
This commit is contained in:
Charles Kerr
2025-07-28 10:22:27 -05:00
committed by GitHub
parent 084c6ef549
commit 2255bb620a
18 changed files with 42 additions and 36 deletions

View File

@@ -232,13 +232,14 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
// avoid conflicts we only initialize our V8 environment after that.
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());
// 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());
isolate, isolate->GetCurrentContext(), js_env_->platform(),
js_env_->max_young_generation_size_in_bytes());
node_env_->set_trace_sync_io(node_env_->options()->trace_sync_io);
@@ -246,7 +247,7 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
node_env_->options()->unhandled_rejections = "warn-with-error-code";
// Add Electron extended APIs.
electron_bindings_->BindTo(js_env_->isolate(), node_env_->process_object());
electron_bindings_->BindTo(isolate, node_env_->process_object());
// Create explicit microtasks runner.
js_env_->CreateMicrotasksRunner();