2018-10-24 18:24:11 +00:00
|
|
|
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.
|
|
|
|
|
2018-10-03 07:06:40 +00:00
|
|
|
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
|
2019-12-11 00:22:35 +00:00
|
|
|
index c3ae4c6221686479d05800c51d17d581c095e397..e4c8a194418dc62f0e0222c08fe9ad39a4b9b9af 100644
|
2018-10-03 07:06:40 +00:00
|
|
|
--- a/gin/isolate_holder.cc
|
|
|
|
+++ b/gin/isolate_holder.cc
|
2019-12-11 00:22:35 +00:00
|
|
|
@@ -53,7 +53,8 @@ IsolateHolder::IsolateHolder(
|
2018-10-03 07:06:40 +00:00
|
|
|
AccessMode access_mode,
|
|
|
|
AllowAtomicsWaitMode atomics_wait_mode,
|
2018-10-24 23:25:48 +00:00
|
|
|
IsolateType isolate_type,
|
2018-10-03 07:06:40 +00:00
|
|
|
- IsolateCreationMode isolate_creation_mode)
|
|
|
|
+ IsolateCreationMode isolate_creation_mode,
|
2018-10-05 18:40:17 +00:00
|
|
|
+ v8::Isolate* isolate)
|
2018-10-24 23:25:48 +00:00
|
|
|
: access_mode_(access_mode), isolate_type_(isolate_type) {
|
2018-10-03 07:06:40 +00:00
|
|
|
DCHECK(task_runner);
|
|
|
|
DCHECK(task_runner->BelongsToCurrentThread());
|
2019-12-11 00:22:35 +00:00
|
|
|
@@ -61,7 +62,11 @@ IsolateHolder::IsolateHolder(
|
2018-10-03 07:06:40 +00:00
|
|
|
v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
|
|
|
|
CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first";
|
|
|
|
|
|
|
|
- isolate_ = v8::Isolate::Allocate();
|
2018-10-05 18:40:17 +00:00
|
|
|
+ if (!isolate) {
|
2018-10-03 07:06:40 +00:00
|
|
|
+ isolate_ = v8::Isolate::Allocate();
|
2018-10-05 18:40:17 +00:00
|
|
|
+ } else {
|
|
|
|
+ isolate_ = isolate;
|
2018-10-03 07:06:40 +00:00
|
|
|
+ }
|
|
|
|
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-10-28 22:12:35 +00:00
|
|
|
index ede178acabc63c3c33d6ce93efd5632bec50ba89..ffe7331cf1806417a32e66970f81b7797b9b80fc 100644
|
2018-10-03 07:06:40 +00:00
|
|
|
--- 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 {
|
2018-10-03 07:06:40 +00:00
|
|
|
AccessMode access_mode,
|
|
|
|
AllowAtomicsWaitMode atomics_wait_mode,
|
2018-10-24 23:25:48 +00:00
|
|
|
IsolateType isolate_type,
|
2018-10-03 07:06:40 +00:00
|
|
|
- IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal);
|
|
|
|
+ IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
|
2018-10-05 18:40:17 +00:00
|
|
|
+ v8::Isolate* isolate = nullptr);
|
2018-10-03 07:06:40 +00:00
|
|
|
~IsolateHolder();
|
|
|
|
|
|
|
|
// Should be invoked once before creating IsolateHolder instances to
|