electron/patches/common/chromium/isolate_holder.patch

51 lines
2.1 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <samuel.r.attard@gmail.com>
Date: Thu, 18 Oct 2018 17:07:27 -0700
Subject: isolate_holder.patch
Pass pre allocated isolate for initialization, node platform
needs to register on an isolate so that it can be used later
down in the initialization process of an isolate.
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
2019-01-16 18:07:52 +00:00
index c8d5b58d711012bf9761ce073af00f30f803081b..ec61b873d4e2dcdca833c8503beabb88d0798f2d 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
2018-10-24 23:25:48 +00:00
@@ -52,7 +52,8 @@ IsolateHolder::IsolateHolder(
AccessMode access_mode,
AllowAtomicsWaitMode atomics_wait_mode,
2018-10-24 23:25:48 +00:00
IsolateType isolate_type,
- IsolateCreationMode isolate_creation_mode)
+ IsolateCreationMode isolate_creation_mode,
+ v8::Isolate* isolate)
2018-10-24 23:25:48 +00:00
: access_mode_(access_mode), isolate_type_(isolate_type) {
DCHECK(task_runner);
DCHECK(task_runner->BelongsToCurrentThread());
2018-10-24 23:25:48 +00:00
@@ -60,7 +61,11 @@ IsolateHolder::IsolateHolder(
v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first";
- isolate_ = v8::Isolate::Allocate();
+ if (!isolate) {
+ isolate_ = v8::Isolate::Allocate();
+ } else {
+ isolate_ = isolate;
+ }
isolate_data_.reset(
new PerIsolateData(isolate_, allocator, access_mode_, task_runner));
if (isolate_creation_mode == IsolateCreationMode::kCreateSnapshot) {
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
2019-01-16 18:07:52 +00:00
index 6c5d101fef97e880bee20d2f76e4b339a624eb6f..576086de0de0a6fea9e2f2077af3aff18fd3138a 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
2019-01-16 18:07:52 +00:00
@@ -75,7 +75,8 @@ class GIN_EXPORT IsolateHolder {
AccessMode access_mode,
AllowAtomicsWaitMode atomics_wait_mode,
2018-10-24 23:25:48 +00:00
IsolateType isolate_type,
- IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal);
+ IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
+ v8::Isolate* isolate = nullptr);
~IsolateHolder();
// Should be invoked once before creating IsolateHolder instances to