electron/patches/chromium/gin_enable_disable_v8_platform.patch
electron-roller[bot] 1eb19f3078
chore: bump chromium to 116.0.5845.0 (main) (#38827)
* chore: bump chromium in DEPS to 116.0.5835.0

* chore: update patches

* chore: bump chromium in DEPS to 116.0.5837.0

* chore: bump chromium in DEPS to 116.0.5839.0

* chore: bump chromium in DEPS to 116.0.5841.0

* chore: bump chromium in DEPS to 116.0.5843.0

* Update patches

CLs that affected printing.patch:
- 4616791: Refactor PrintViewManagerBase::PrintNow()
  https://chromium-review.googlesource.com/c/chromium/src/+/4616791
- 4602776: Make PrintNodeUnderContextMenu operation go through PrintViewManager
  https://chromium-review.googlesource.com/c/chromium/src/+/4602776

* 4506614: geolocation: Add LocationProvider::FillDiagnostics
https://chromium-review.googlesource.com/c/chromium/src/+/4506614

* chore: bump chromium in DEPS to 116.0.5845.0

* chore: update patches

* fixup! 4506614: geolocation: Add LocationProvider::FillDiagnostics https://chromium-review.googlesource.com/c/chromium/src/+/4506614

* 4609704: Remove gnome-keyring
https://chromium-review.googlesource.com/c/chromium/src/+/4609704

---------

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: clavin <clavin@electronjs.org>
2023-06-22 10:51:15 +02:00

77 lines
4 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 e8608bb868c82c9af5426cd6f8512ce6b18ff39f..6268851494a0bbc0b3e693782dae6171f6347657 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -136,9 +136,10 @@ void IsolateHolder::Initialize(ScriptMode mode,
const intptr_t* reference_table,
const std::string js_command_line_flags,
v8::FatalErrorCallback fatal_error_callback,
- v8::OOMErrorCallback oom_error_callback) {
+ v8::OOMErrorCallback oom_error_callback,
+ bool create_v8_platform) {
CHECK(allocator);
- V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback);
+ V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback, create_v8_platform);
g_array_buffer_allocator = allocator;
g_reference_table = reference_table;
g_fatal_error_callback = fatal_error_callback;
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index 10caab6d9ef3345332c163a55dcef991248ab4ea..c9bc6e5dd7e1cf8d198afcd21cbb24970337a50f 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -109,7 +109,8 @@ class GIN_EXPORT IsolateHolder {
const intptr_t* reference_table = nullptr,
const std::string js_command_line_flags = {},
v8::FatalErrorCallback fatal_error_callback = nullptr,
- v8::OOMErrorCallback oom_error_callback = nullptr);
+ v8::OOMErrorCallback oom_error_callback = 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 45da70dd0d164bd5be17ef4e3731f2a3c597571f..4c2a4783f894c2dc62d87dfc51e2ebb8a0b51b2e 100644
--- a/gin/v8_initializer.cc
+++ b/gin/v8_initializer.cc
@@ -420,7 +420,8 @@ void SetFlags(IsolateHolder::ScriptMode mode,
// static
void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
const std::string js_command_line_flags,
- v8::OOMErrorCallback oom_error_callback) {
+ v8::OOMErrorCallback oom_error_callback,
+ bool create_v8_platform) {
static bool v8_is_initialized = false;
if (v8_is_initialized)
return;
@@ -430,7 +431,8 @@ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
// See https://crbug.com/v8/11043
SetFlags(mode, js_command_line_flags);
- v8::V8::InitializePlatform(V8Platform::Get());
+ if (create_v8_platform)
+ v8::V8::InitializePlatform(V8Platform::Get());
// Set this as early as possible in order to ensure OOM errors are reported
// correctly.
diff --git a/gin/v8_initializer.h b/gin/v8_initializer.h
index d499cb43c4e12ca32912fce7078fcadff7509a87..dd9899c3e0dbadfc0074ffce87d51193e1c963cb 100644
--- a/gin/v8_initializer.h
+++ b/gin/v8_initializer.h
@@ -31,7 +31,8 @@ class GIN_EXPORT V8Initializer {
// This should be called by IsolateHolder::Initialize().
static void Initialize(IsolateHolder::ScriptMode mode,
const std::string js_command_line_flags = {},
- v8::OOMErrorCallback oom_error_callback = nullptr);
+ v8::OOMErrorCallback oom_error_callback = nullptr,
+ 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