mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: enable worker threads in ELECTRON_RUN_AS_NODE (#20457)
This commit is contained in:
committed by
John Kleinschmidt
parent
e501930d38
commit
03d16f37d2
@@ -54,5 +54,6 @@ chore_read_nobrowserglobals_from_global_not_process.patch
|
||||
chore_use_v8_inspector_js_protocol_to_find_pdl_file.patch
|
||||
chore_split_createenvironment_into_createenvironment_and.patch
|
||||
fix_set_uptime_offset_in_correct_init_method.patch
|
||||
fix_enable_worker_threads.patch
|
||||
fsevents-stop-using-fsevents-to-watch-files.patch
|
||||
fsevents-regression-in-watching.patch
|
||||
|
||||
29
patches/node/fix_enable_worker_threads.patch
Normal file
29
patches/node/fix_enable_worker_threads.patch
Normal file
@@ -0,0 +1,29 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Shelley Vohr <shelley.vohr@gmail.com>
|
||||
Date: Thu, 3 Oct 2019 19:03:30 +0200
|
||||
Subject: fix: enable worker_threads
|
||||
|
||||
Electron sets NODE_USE_V8_PLATFORM to false, because Electron
|
||||
initializes the v8 platform itself and Node.js worker thread
|
||||
initialization relies on the platform it uses having been set inside
|
||||
code guarded by NODE_USE_V8_PLATFORM.
|
||||
|
||||
This commit fixes this problem by changing node_worker to use the three-arg
|
||||
implementation of `NewIsolate` to prevent it trying to use a possibly-null ptr.
|
||||
|
||||
diff --git a/src/node_worker.cc b/src/node_worker.cc
|
||||
index 8f97f5c351..2bfbb28e61 100644
|
||||
--- a/src/node_worker.cc
|
||||
+++ b/src/node_worker.cc
|
||||
@@ -112,7 +112,10 @@ class WorkerThreadData {
|
||||
array_buffer_allocator_(ArrayBufferAllocator::Create()) {
|
||||
CHECK_EQ(uv_loop_init(&loop_), 0);
|
||||
|
||||
- Isolate* isolate = NewIsolate(array_buffer_allocator_.get(), &loop_);
|
||||
+ Isolate* isolate = NewIsolate(
|
||||
+ array_buffer_allocator_.get(),
|
||||
+ &loop_,
|
||||
+ w->platform_);
|
||||
CHECK_NOT_NULL(isolate);
|
||||
|
||||
{
|
||||
Reference in New Issue
Block a user