fix: missing handlescopes in event emission (#23140)
* fix: missing event emitter handlescopes * refactor: add static getter to js env
This commit is contained in:
parent
9bb8e43c9b
commit
ac5c30a707
5 changed files with 32 additions and 0 deletions
|
@ -20,6 +20,10 @@
|
|||
#include "shell/common/node_includes.h"
|
||||
#include "tracing/trace_event.h"
|
||||
|
||||
namespace {
|
||||
v8::Isolate* g_isolate;
|
||||
}
|
||||
|
||||
namespace electron {
|
||||
|
||||
JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
|
||||
|
@ -46,6 +50,7 @@ JavascriptEnvironment::~JavascriptEnvironment() {
|
|||
context_.Get(isolate_)->Exit();
|
||||
}
|
||||
isolate_->Exit();
|
||||
g_isolate = nullptr;
|
||||
}
|
||||
|
||||
v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
|
||||
|
@ -73,10 +78,17 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
|
|||
|
||||
v8::Isolate* isolate = v8::Isolate::Allocate();
|
||||
platform_->RegisterIsolate(isolate, event_loop);
|
||||
g_isolate = isolate;
|
||||
|
||||
return isolate;
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Isolate* JavascriptEnvironment::GetIsolate() {
|
||||
CHECK(g_isolate);
|
||||
return g_isolate;
|
||||
}
|
||||
|
||||
void JavascriptEnvironment::OnMessageLoopCreated() {
|
||||
DCHECK(!microtasks_runner_);
|
||||
microtasks_runner_ = std::make_unique<MicrotasksRunner>(isolate());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue