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-08-17 18:35:53 +00:00
|
|
|
index 88f9e4dd05d8efdabbbdd044f5e09e844ced3d55..c254b045494936eca14ce947e1c2de3327820aa2 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/isolate_holder.cc
|
|
|
|
+++ b/gin/isolate_holder.cc
|
2022-08-17 18:35:53 +00:00
|
|
|
@@ -137,9 +137,10 @@ void IsolateHolder::Initialize(ScriptMode mode,
|
2021-11-24 08:45:59 +00:00
|
|
|
const intptr_t* reference_table,
|
2022-04-22 22:36:22 +00:00
|
|
|
const std::string js_command_line_flags,
|
|
|
|
v8::FatalErrorCallback fatal_error_callback,
|
|
|
|
- v8::OOMErrorCallback oom_error_callback) {
|
|
|
|
+ v8::OOMErrorCallback oom_error_callback,
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform) {
|
|
|
|
CHECK(allocator);
|
2022-04-22 22:36:22 +00:00
|
|
|
- V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback);
|
|
|
|
+ V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback, create_v8_platform);
|
2018-09-14 05:02:16 +00:00
|
|
|
g_array_buffer_allocator = allocator;
|
|
|
|
g_reference_table = reference_table;
|
2022-04-22 22:36:22 +00:00
|
|
|
g_fatal_error_callback = fatal_error_callback;
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
|
2022-08-17 18:35:53 +00:00
|
|
|
index d7739924bc3c3daec848db52730bd60c72ff2d8a..78af701cb06f6cb1bdd9829b2fcc46c8d63f5c4f 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/public/isolate_holder.h
|
|
|
|
+++ b/gin/public/isolate_holder.h
|
2022-08-17 18:35:53 +00:00
|
|
|
@@ -109,7 +109,8 @@ class GIN_EXPORT IsolateHolder {
|
2021-11-24 08:45:59 +00:00
|
|
|
const intptr_t* reference_table = nullptr,
|
2022-04-22 22:36:22 +00:00
|
|
|
const std::string js_command_line_flags = {},
|
|
|
|
v8::FatalErrorCallback fatal_error_callback = nullptr,
|
|
|
|
- v8::OOMErrorCallback oom_error_callback = nullptr);
|
|
|
|
+ v8::OOMErrorCallback oom_error_callback = nullptr,
|
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-08-17 18:35:53 +00:00
|
|
|
index ab2affbcab0ca7eea0b908fd1dd75f36ef095385..952b3ba6247935053d9a080bced30e3b3c640dd4 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.cc
|
|
|
|
+++ b/gin/v8_initializer.cc
|
2022-08-17 18:35:53 +00:00
|
|
|
@@ -362,7 +362,8 @@ 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,
|
2022-04-22 22:36:22 +00:00
|
|
|
const std::string js_command_line_flags,
|
|
|
|
- v8::OOMErrorCallback oom_error_callback) {
|
|
|
|
+ v8::OOMErrorCallback oom_error_callback,
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform) {
|
|
|
|
static bool v8_is_initialized = false;
|
|
|
|
if (v8_is_initialized)
|
|
|
|
return;
|
2022-08-17 18:35:53 +00:00
|
|
|
@@ -372,7 +373,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
2022-03-25 01:39:03 +00:00
|
|
|
// See https://crbug.com/v8/11043
|
|
|
|
SetFlags(mode, js_command_line_flags);
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
- v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
+ if (create_v8_platform)
|
|
|
|
+ v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
|
2022-04-22 22:36:22 +00:00
|
|
|
// Set this as early as possible in order to ensure OOM errors are reported
|
|
|
|
// correctly.
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
|
2022-04-22 22:36:22 +00:00
|
|
|
index da5b4017b4a8128bf620d4b43d4c2d183719265b..13a120c7fe8e69a44793473f3124c33d572a07a3 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.h
|
|
|
|
+++ b/gin/v8_initializer.h
|
2022-04-22 22:36:22 +00:00
|
|
|
@@ -31,7 +31,8 @@ class GIN_EXPORT V8Initializer {
|
2018-09-14 05:02:16 +00:00
|
|
|
// This should be called by IsolateHolder::Initialize().
|
2021-11-24 08:45:59 +00:00
|
|
|
static void Initialize(IsolateHolder::ScriptMode mode,
|
2022-04-22 22:36:22 +00:00
|
|
|
const std::string js_command_line_flags = {},
|
|
|
|
- v8::OOMErrorCallback oom_error_callback = nullptr);
|
|
|
|
+ v8::OOMErrorCallback oom_error_callback = nullptr,
|
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
|