refactor: use associated v8::Context
for event setup (#37355)
refactor: use associated v8::Context for event setup
This commit is contained in:
parent
32c60b29bb
commit
6395898a79
5 changed files with 6 additions and 7 deletions
|
@ -270,7 +270,7 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
|
||||||
|
|
||||||
v8::HandleScope scope(js_env_->isolate());
|
v8::HandleScope scope(js_env_->isolate());
|
||||||
|
|
||||||
node_bindings_->Initialize();
|
node_bindings_->Initialize(js_env_->isolate()->GetCurrentContext());
|
||||||
// Create the global environment.
|
// Create the global environment.
|
||||||
node::Environment* env = node_bindings_->CreateEnvironment(
|
node::Environment* env = node_bindings_->CreateEnvironment(
|
||||||
js_env_->isolate()->GetCurrentContext(), js_env_->platform());
|
js_env_->isolate()->GetCurrentContext(), js_env_->platform());
|
||||||
|
|
|
@ -415,7 +415,7 @@ void NodeBindings::SetNodeCliFlags() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeBindings::Initialize() {
|
void NodeBindings::Initialize(v8::Local<v8::Context> context) {
|
||||||
TRACE_EVENT0("electron", "NodeBindings::Initialize");
|
TRACE_EVENT0("electron", "NodeBindings::Initialize");
|
||||||
// Open node's error reporting system for browser process.
|
// Open node's error reporting system for browser process.
|
||||||
|
|
||||||
|
@ -463,8 +463,7 @@ void NodeBindings::Initialize() {
|
||||||
SetErrorMode(GetErrorMode() & ~SEM_NOGPFAULTERRORBOX);
|
SetErrorMode(GetErrorMode() & ~SEM_NOGPFAULTERRORBOX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
gin_helper::internal::Event::GetConstructor(context);
|
||||||
gin_helper::internal::Event::GetConstructor(isolate->GetCurrentContext());
|
|
||||||
|
|
||||||
g_is_initialized = true;
|
g_is_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class NodeBindings {
|
||||||
virtual ~NodeBindings();
|
virtual ~NodeBindings();
|
||||||
|
|
||||||
// Setup V8, libuv.
|
// Setup V8, libuv.
|
||||||
void Initialize();
|
void Initialize(v8::Local<v8::Context> context);
|
||||||
|
|
||||||
void SetNodeCliFlags();
|
void SetNodeCliFlags();
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ void ElectronRendererClient::DidCreateScriptContext(
|
||||||
|
|
||||||
if (!node_integration_initialized_) {
|
if (!node_integration_initialized_) {
|
||||||
node_integration_initialized_ = true;
|
node_integration_initialized_ = true;
|
||||||
node_bindings_->Initialize();
|
node_bindings_->Initialize(renderer_context);
|
||||||
node_bindings_->PrepareEmbedThread();
|
node_bindings_->PrepareEmbedThread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ void NodeService::Initialize(node::mojom::NodeServiceParamsPtr params) {
|
||||||
|
|
||||||
v8::HandleScope scope(js_env_->isolate());
|
v8::HandleScope scope(js_env_->isolate());
|
||||||
|
|
||||||
node_bindings_->Initialize();
|
node_bindings_->Initialize(js_env_->isolate()->GetCurrentContext());
|
||||||
|
|
||||||
// Append program path for process.argv0
|
// Append program path for process.argv0
|
||||||
auto program = base::CommandLine::ForCurrentProcess()->GetProgram();
|
auto program = base::CommandLine::ForCurrentProcess()->GetProgram();
|
||||||
|
|
Loading…
Reference in a new issue