2018-10-24 18:24:11 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-21 00:30:26 +00:00
|
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
|
|
Date: Thu, 20 Sep 2018 17:47:44 -0700
|
|
|
|
Subject: gin_enable_disable_v8_platform.patch
|
|
|
|
|
2019-12-13 17:18:45 +00:00
|
|
|
We don't use gin to create the V8 platform, because we need to inject Node
|
|
|
|
things.
|
2018-09-21 00:30:26 +00:00
|
|
|
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
|
2022-02-10 02:58:52 +00:00
|
|
|
index 0cd4077a0b534f089318e1ebffb9eb25214c3a42..f1ea1dfd740f4b9cf5f7cb7fd6bd445fb06e0100 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/isolate_holder.cc
|
|
|
|
+++ b/gin/isolate_holder.cc
|
2022-02-10 02:58:52 +00:00
|
|
|
@@ -117,9 +117,10 @@ IsolateHolder::~IsolateHolder() {
|
2018-09-14 05:02:16 +00:00
|
|
|
void IsolateHolder::Initialize(ScriptMode mode,
|
|
|
|
v8::ArrayBuffer::Allocator* allocator,
|
2021-11-24 08:45:59 +00:00
|
|
|
const intptr_t* reference_table,
|
|
|
|
- const std::string js_command_line_flags) {
|
|
|
|
+ const std::string js_command_line_flags,
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform) {
|
|
|
|
CHECK(allocator);
|
2021-11-24 08:45:59 +00:00
|
|
|
- V8Initializer::Initialize(mode, js_command_line_flags);
|
|
|
|
+ V8Initializer::Initialize(mode, js_command_line_flags, create_v8_platform);
|
2018-09-14 05:02:16 +00:00
|
|
|
g_array_buffer_allocator = allocator;
|
|
|
|
g_reference_table = reference_table;
|
|
|
|
}
|
|
|
|
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
|
2022-01-10 22:31:39 +00:00
|
|
|
index 78133f9b34327c311c69620af621eba3d7f2cbf9..a965545de342811e468594fab4d792fc5c4daf32 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/public/isolate_holder.h
|
|
|
|
+++ b/gin/public/isolate_holder.h
|
2022-01-10 22:31:39 +00:00
|
|
|
@@ -100,7 +100,8 @@ class GIN_EXPORT IsolateHolder {
|
2018-09-14 05:02:16 +00:00
|
|
|
static void Initialize(ScriptMode mode,
|
|
|
|
v8::ArrayBuffer::Allocator* allocator,
|
2021-11-24 08:45:59 +00:00
|
|
|
const intptr_t* reference_table = nullptr,
|
|
|
|
- const std::string js_command_line_flags = {});
|
|
|
|
+ const std::string js_command_line_flags = {},
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform = true);
|
|
|
|
|
2021-07-26 16:02:16 +00:00
|
|
|
// Returns whether `Initialize` has already been invoked in the process.
|
|
|
|
// Initialization is a one-way operation (i.e., this method cannot return
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
2022-02-10 02:58:52 +00:00
|
|
|
index 1447b3828da1e50bd00f4a4975a2b4ce76a2c6ac..abdc2d491cd317d38cb4e7608681ea97bb5b8aab 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.cc
|
|
|
|
+++ b/gin/v8_initializer.cc
|
2022-02-10 02:58:52 +00:00
|
|
|
@@ -342,12 +342,14 @@ void SetFlags(IsolateHolder::ScriptMode mode,
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
// static
|
2021-11-24 08:45:59 +00:00
|
|
|
void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
|
|
|
- const std::string js_command_line_flags) {
|
|
|
|
+ const std::string js_command_line_flags,
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform) {
|
|
|
|
static bool v8_is_initialized = false;
|
|
|
|
if (v8_is_initialized)
|
|
|
|
return;
|
|
|
|
|
|
|
|
- v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
+ if (create_v8_platform)
|
|
|
|
+ v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
|
2021-11-24 08:45:59 +00:00
|
|
|
// Set this early on as some initialization steps, such as the initialization
|
|
|
|
// of the virtual memory cage, already use V8's random number generator.
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
|
2022-02-10 02:58:52 +00:00
|
|
|
index beeedc5737f6e60dde123200fbb6430a40366577..17ee4c894e89b7d2d12377475a5dd01910b61312 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.h
|
|
|
|
+++ b/gin/v8_initializer.h
|
2021-11-24 08:45:59 +00:00
|
|
|
@@ -29,7 +29,8 @@ class GIN_EXPORT V8Initializer {
|
2018-09-14 05:02:16 +00:00
|
|
|
public:
|
|
|
|
// This should be called by IsolateHolder::Initialize().
|
2021-11-24 08:45:59 +00:00
|
|
|
static void Initialize(IsolateHolder::ScriptMode mode,
|
|
|
|
- const std::string js_command_line_flags = {});
|
|
|
|
+ const std::string js_command_line_flags = {},
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform = true);
|
|
|
|
|
|
|
|
// Get address and size information for currently loaded snapshot.
|
|
|
|
// If no snapshot is loaded, the return values are null for addresses
|