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
|
2020-05-26 20:06:26 +00:00
|
|
|
index 570a23af3c0fb4839b063c742d1d345a27799cd0..ece381bb1ce22bc65c3d8e428354adeb4b6fe4c1 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/isolate_holder.cc
|
|
|
|
+++ b/gin/isolate_holder.cc
|
2019-12-11 00:22:35 +00:00
|
|
|
@@ -103,9 +103,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
|
2019-10-28 22:12:35 +00:00
|
|
|
index f23af2d9738f3aa76e3a49301e1c3216ee4a64b4..ede178acabc63c3c33d6ce93efd5632bec50ba89 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/public/isolate_holder.h
|
|
|
|
+++ b/gin/public/isolate_holder.h
|
2019-10-28 22:12:35 +00:00
|
|
|
@@ -88,7 +88,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);
|
|
|
|
|
|
|
|
v8::Isolate* isolate() { return isolate_; }
|
|
|
|
|
|
|
|
diff --git a/gin/v8_initializer.cc b/gin/v8_initializer.cc
|
2020-05-26 20:06:26 +00:00
|
|
|
index 517283e2f1886408ee5ad935e3bafecb9728ca94..e7224adc9f4def27a370bcca8effd7bccc01ab02 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.cc
|
|
|
|
+++ b/gin/v8_initializer.cc
|
2020-05-26 20:06:26 +00:00
|
|
|
@@ -191,12 +191,14 @@ enum LoadV8FileResult {
|
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;
|
|
|
|
|
|
|
|
- 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
|
2019-10-28 22:12:35 +00:00
|
|
|
index 2918c6235688ee4eb7c43387296e6d24145c14aa..069c2c96d5067f0444dac3c6ce6d83f75e770129 100644
|
2018-09-14 05:02:16 +00:00
|
|
|
--- a/gin/v8_initializer.h
|
|
|
|
+++ b/gin/v8_initializer.h
|
2019-01-16 18:07:52 +00:00
|
|
|
@@ -20,7 +20,8 @@ namespace gin {
|
|
|
|
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
|