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
|
2021-09-01 19:55:07 +00:00
|
|
|
index e93824463817a71903631dd722ffdfddb65bab3e..366e105c968b1be51eb0f26709486d086cf12eca 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/isolate_holder.cc
|
|
|
|
+++ b/gin/isolate_holder.cc
|
2021-09-01 19:55:07 +00:00
|
|
|
@@ -110,9 +110,10 @@ IsolateHolder::~IsolateHolder() {
|
2019-01-16 18:07:52 +00:00
|
|
|
// static
|
2018-09-14 05:02:16 +00:00
|
|
|
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);
|
2019-01-16 18:07:52 +00:00
|
|
|
- V8Initializer::Initialize(mode);
|
|
|
|
+ V8Initializer::Initialize(mode, 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
|
2021-09-01 19:55:07 +00:00
|
|
|
index f0a7d0c05fa3c68b22b1d36e2c0810fe70f5a8a0..8ecce17b5bb8b5106de913a2d0197fd3affb1c08 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/public/isolate_holder.h
|
|
|
|
+++ b/gin/public/isolate_holder.h
|
2021-09-01 19:55:07 +00:00
|
|
|
@@ -94,7 +94,8 @@ class GIN_EXPORT IsolateHolder {
|
2019-01-16 18:07:52 +00:00
|
|
|
// reference pointers. Otherwise, it can be nullptr.
|
2018-09-14 05:02:16 +00:00
|
|
|
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);
|
|
|
|
|
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
|
2021-09-01 19:55:07 +00:00
|
|
|
index 941ced089ed7e201d348b58b38d9d0d74bc843b1..9c78e04219e5bcd8d8044e576367833d0891f7d6 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.cc
|
|
|
|
+++ b/gin/v8_initializer.cc
|
2021-09-01 19:55:07 +00:00
|
|
|
@@ -269,7 +269,8 @@ void SetV8FlagsIfOverridden(const base::Feature& feature,
|
2019-01-16 18:07:52 +00:00
|
|
|
} // namespace
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
// static
|
2019-01-16 18:07:52 +00:00
|
|
|
-void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
|
|
|
+void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
2018-09-14 05:02:16 +00:00
|
|
|
+ bool create_v8_platform) {
|
|
|
|
static bool v8_is_initialized = false;
|
|
|
|
if (v8_is_initialized)
|
|
|
|
return;
|
2021-09-01 19:55:07 +00:00
|
|
|
@@ -279,7 +280,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode) {
|
2021-06-22 19:17:16 +00:00
|
|
|
RunArrayBufferCageReservationExperiment();
|
|
|
|
}
|
2018-09-14 05:02:16 +00:00
|
|
|
|
|
|
|
- v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
+ if (create_v8_platform)
|
|
|
|
+ v8::V8::InitializePlatform(V8Platform::Get());
|
|
|
|
|
2018-10-24 23:25:48 +00:00
|
|
|
if (!base::FeatureList::IsEnabled(features::kV8OptimizeJavascript)) {
|
|
|
|
// We avoid explicitly passing --opt if kV8OptimizeJavascript is enabled
|
2018-09-14 05:02:16 +00:00
|
|
|
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
|
2021-09-01 19:55:07 +00:00
|
|
|
index 955be10e118e1c54515dd0ee19edec7504419bdc..699f84c73b71a6d870ae93f2fce98174c924e2fa 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.h
|
|
|
|
+++ b/gin/v8_initializer.h
|
2021-09-01 19:55:07 +00:00
|
|
|
@@ -24,7 +24,8 @@ namespace gin {
|
2019-01-16 18:07:52 +00:00
|
|
|
class GIN_EXPORT V8Initializer {
|
2018-09-14 05:02:16 +00:00
|
|
|
public:
|
|
|
|
// This should be called by IsolateHolder::Initialize().
|
2019-01-16 18:07:52 +00:00
|
|
|
- static void Initialize(IsolateHolder::ScriptMode mode);
|
|
|
|
+ static void Initialize(IsolateHolder::ScriptMode mode,
|
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
|