mirror of
https://github.com/electron/electron.git
synced 2026-02-17 02:21:37 -05:00
76 lines
3.1 KiB
Diff
76 lines
3.1 KiB
Diff
From eaf64921a97d513151d48ab01975b5ac966a7e34 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 e3a23cf30e42..e099fd3f03e5 100644
|
|
--- a/gin/isolate_holder.cc
|
|
+++ b/gin/isolate_holder.cc
|
|
@@ -116,9 +116,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 a70ad1ce51a9..84cf66e6e9cd 100644
|
|
--- a/gin/public/isolate_holder.h
|
|
+++ b/gin/public/isolate_holder.h
|
|
@@ -83,7 +83,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 be2b9149e440..816e56aa4f6b 100644
|
|
--- a/gin/v8_initializer.cc
|
|
+++ b/gin/v8_initializer.cc
|
|
@@ -236,12 +236,14 @@ LoadV8FileResult MapOpenedFile(const OpenedFileMap::mapped_type& file_region,
|
|
|
|
// 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)) {
|
|
static const char optimize[] = "--opt";
|
|
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
|
|
index 6f3265ba4d06..29f28bebbdcd 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
|
|
--
|
|
2.17.0
|
|
|