mirror of
https://github.com/electron/electron.git
synced 2026-02-18 02:51:53 -05:00
73 lines
3.3 KiB
Diff
73 lines
3.3 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
|
|
|
|
|
|
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
|
|
index 5670a2e55ef827068c547f4a76de18a12936d115..3332f4936c633f834576ae2eb0a4c59de482881e 100644
|
|
--- a/gin/isolate_holder.cc
|
|
+++ b/gin/isolate_holder.cc
|
|
@@ -121,9 +121,10 @@ IsolateHolder::~IsolateHolder() {
|
|
void IsolateHolder::Initialize(ScriptMode mode,
|
|
V8ExtrasMode v8_extras_mode,
|
|
v8::ArrayBuffer::Allocator* allocator,
|
|
- const intptr_t* reference_table) {
|
|
+ const intptr_t* reference_table,
|
|
+ bool create_v8_platform) {
|
|
CHECK(allocator);
|
|
- V8Initializer::Initialize(mode, v8_extras_mode);
|
|
+ V8Initializer::Initialize(mode, v8_extras_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 8cb2646bdd7dc3f5013d197f4b76e8707afb6817..95844885e478e460b1f03a7d98942bffe263e3d0 100644
|
|
--- a/gin/public/isolate_holder.h
|
|
+++ b/gin/public/isolate_holder.h
|
|
@@ -98,7 +98,8 @@ class GIN_EXPORT IsolateHolder {
|
|
static void Initialize(ScriptMode mode,
|
|
V8ExtrasMode v8_extras_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
|
|
index 4b3ef5cfa0684b31cf2e35acb27a1adee9dddfbb..ce0be2126d62754662c706698fc75e91e64af7f7 100644
|
|
--- a/gin/v8_initializer.cc
|
|
+++ b/gin/v8_initializer.cc
|
|
@@ -205,12 +205,14 @@ enum LoadV8FileResult {
|
|
|
|
// static
|
|
void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
|
|
- IsolateHolder::V8ExtrasMode v8_extras_mode) {
|
|
+ IsolateHolder::V8ExtrasMode v8_extras_mode,
|
|
+ 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());
|
|
|
|
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 a749ccbecfc8b82217d4ed48dcf8a5d9ceba052c..00b21585e65b2fcb2401d28d425f7db2e5dec389 100644
|
|
--- a/gin/v8_initializer.h
|
|
+++ b/gin/v8_initializer.h
|
|
@@ -21,7 +21,8 @@ class GIN_EXPORT V8Initializer {
|
|
public:
|
|
// This should be called by IsolateHolder::Initialize().
|
|
static void Initialize(IsolateHolder::ScriptMode mode,
|
|
- IsolateHolder::V8ExtrasMode v8_extras_mode);
|
|
+ IsolateHolder::V8ExtrasMode v8_extras_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
|