-
Notifications
You must be signed in to change notification settings - Fork 15k
/
fix_enable_worker_threads.patch
29 lines (24 loc) · 1.13 KB
/
fix_enable_worker_threads.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 8f97f5c3514639ab799c316b67bd782dfbda17f8..edc5a7fcaf8995df790151037ca0c6894fb1885c 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);
{