64ba8feb93
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Jeremy Rose <jeremya@chromium.org>
77 lines
3.5 KiB
Diff
77 lines
3.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cheng Zhao <zcbenz@gmail.com>
|
|
Date: Thu, 20 Sep 2018 17:47:44 -0700
|
|
Subject: gin_enable_disable_v8_platform.patch
|
|
|
|
We don't use gin to create the V8 platform, because we need to inject Node
|
|
things.
|
|
|
|
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
|
|
index f86478fb8652255fa30252d027bfed2121ed138e..5eed541856097c2edf12c49a6a04dc583a9cceb6 100644
|
|
--- a/gin/isolate_holder.cc
|
|
+++ b/gin/isolate_holder.cc
|
|
@@ -108,9 +108,10 @@ IsolateHolder::~IsolateHolder() {
|
|
// static
|
|
void IsolateHolder::Initialize(ScriptMode mode,
|
|
v8::ArrayBuffer::Allocator* allocator,
|
|
- const intptr_t* reference_table) {
|
|
+ const intptr_t* reference_table,
|
|
+ bool create_v8_platform) {
|
|
CHECK(allocator);
|
|
- V8Initializer::Initialize(mode);
|
|
+ V8Initializer::Initialize(mode, create_v8_platform);
|
|
g_array_buffer_allocator = allocator;
|
|
g_reference_table = reference_table;
|
|
}
|
|
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
|
|
index 41e516899dccb6352aabadcd66a93d69e13031b6..e476c6b4a58caa30d81d082200bfd8c80904857a 100644
|
|
--- a/gin/public/isolate_holder.h
|
|
+++ b/gin/public/isolate_holder.h
|
|
@@ -89,7 +89,8 @@ class GIN_EXPORT IsolateHolder {
|
|
// reference pointers. Otherwise, it can be nullptr.
|
|
static void Initialize(ScriptMode mode,
|
|
v8::ArrayBuffer::Allocator* allocator,
|
|
- const intptr_t* reference_table = nullptr);
|
|
+ const intptr_t* reference_table = nullptr,
|
|
+ bool create_v8_platform = true);
|
|
|
|
// Returns whether `Initialize` has already been invoked in the process.
|
|
// Initialization is a one-way operation (i.e., this method cannot return
|
|
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
|
index 4ba7c59e97fd0c6234c35db3a10bcb51e6088804..32aa9eda0baba8fbe81f98504f2a6c5acc60a2f3 100644
|
|
--- a/gin/v8_initializer.cc
|
|
+++ b/gin/v8_initializer.cc
|
|
@@ -267,7 +267,8 @@ void SetV8FlagsIfOverridden(const base::Feature& feature,
|
|
} // namespace
|
|
|
|
// static
|
|
-void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
|
+void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
|
+ bool create_v8_platform) {
|
|
static bool v8_is_initialized = false;
|
|
if (v8_is_initialized)
|
|
return;
|
|
@@ -277,7 +278,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
|
RunArrayBufferCageReservationExperiment();
|
|
}
|
|
|
|
- v8::V8::InitializePlatform(V8Platform::Get());
|
|
+ if (create_v8_platform)
|
|
+ v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
if (!base::FeatureList::IsEnabled(features::kV8OptimizeJavascript)) {
|
|
// We avoid explicitly passing --opt if kV8OptimizeJavascript is enabled
|
|
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
|
|
index 2918c6235688ee4eb7c43387296e6d24145c14aa..069c2c96d5067f0444dac3c6ce6d83f75e770129 100644
|
|
--- a/gin/v8_initializer.h
|
|
+++ b/gin/v8_initializer.h
|
|
@@ -20,7 +20,8 @@ namespace gin {
|
|
class GIN_EXPORT V8Initializer {
|
|
public:
|
|
// This should be called by IsolateHolder::Initialize().
|
|
- static void Initialize(IsolateHolder::ScriptMode mode);
|
|
+ static void Initialize(IsolateHolder::ScriptMode mode,
|
|
+ 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
|