electron/patches/chromium/isolate_holder.patch
electron-roller[bot] f3e0517b6e
chore: bump chromium to 102.0.4999.0 (main) (#33731)
* chore: bump chromium in DEPS to 102.0.4999.0

* 3576640: Set OOM handler during V8 initialization

https://chromium-review.googlesource.com/c/chromium/src/+/3576640

* 3574964: Remove deprecated base::Value usage in print_settings_conversion code.

https://chromium-review.googlesource.com/c/chromium/src/+/3574964

* 3570062: Replicate Active state to render process for all RenderViews.

https://chromium-review.googlesource.com/c/chromium/src/+/3570062

* chore: fixup patch indices

* 3380402: Remove legacy SwiftShader

https://chromium-review.googlesource.com/c/chromium/src/+/3380402

* 3570254: [Local Fonts] Rename permission name from FONT_ACCESS to LOCAL_FONTS.

https://chromium-review.googlesource.com/c/chromium/src/+/3570254

* 3572172: Rename or remove several parameters involved in creation of MimeHandler streams

https://chromium-review.googlesource.com/c/chromium/src/+/3572172

* fix: add missing base/bits include

* chore: fix lint

* chore: remove ia32 Linux support

* chore: patch out swift-format cipd dep on macOS

* build: apply patch better

* build: reset all caches

* build: update zip manifests to remove swiftshared libraries

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3380402

* Revert "build: update zip manifests to remove swiftshared libraries"

This reverts commit 6aeec01ef1a79425a7b7d8c1cfb131a26b91c494.

* Revert "3380402: Remove legacy SwiftShader"

This reverts commit 4c7eebbbf2d0a459cc192959e17ae20f970c2da2.

* build: remove unused swiftshader egl libraries

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-04-22 15:36:22 -07:00

53 lines
2.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samuel Attard <samuel.r.attard@gmail.com>
Date: Thu, 18 Oct 2018 17:07:27 -0700
Subject: isolate_holder.patch
Pass pre allocated isolate for initialization, node platform
needs to register on an isolate so that it can be used later
down in the initialization process of an isolate.
Specifically, v8::Isolate::Initialize ends up calling
NodePlatform::GetForegroundTaskRunner, which requires that the
isolate has previously been registered with NodePlatform::RegisterIsolate.
However, if we let gin allocate the isolate, there's no opportunity
for us to register the isolate in between Isolate::Allocate and
Isolate::Initialize.
diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index 7d9068b87eee4dbc3435ed6f67285d428dc85f52..c0b8c6e5b49390b8a87d6a9d19605f6b6a1c3562 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -59,7 +59,8 @@ IsolateHolder::IsolateHolder(
IsolateType isolate_type,
IsolateCreationMode isolate_creation_mode,
v8::CreateHistogramCallback create_histogram_callback,
- v8::AddHistogramSampleCallback add_histogram_sample_callback)
+ v8::AddHistogramSampleCallback add_histogram_sample_callback,
+ v8::Isolate* isolate)
: access_mode_(access_mode), isolate_type_(isolate_type) {
CHECK(Initialized())
<< "You need to invoke gin::IsolateHolder::Initialize first";
@@ -70,7 +71,7 @@ IsolateHolder::IsolateHolder(
v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
DCHECK(allocator);
- isolate_ = v8::Isolate::Allocate();
+ isolate_ = isolate ? isolate : v8::Isolate::Allocate();
isolate_data_ = std::make_unique<PerIsolateData>(isolate_, allocator,
access_mode_, task_runner);
if (isolate_creation_mode == IsolateCreationMode::kCreateSnapshot) {
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index 4efc13c79ae742fa1925d064318627452ba852b2..978c0d144370162e65038cf8a2e125fbfd0f7ebf 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -82,7 +82,8 @@ class GIN_EXPORT IsolateHolder {
IsolateType isolate_type,
IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
v8::CreateHistogramCallback create_histogram_callback = nullptr,
- v8::AddHistogramSampleCallback add_histogram_sample_callback = nullptr);
+ v8::AddHistogramSampleCallback add_histogram_sample_callback = nullptr,
+ v8::Isolate* isolate = nullptr);
IsolateHolder(const IsolateHolder&) = delete;
IsolateHolder& operator=(const IsolateHolder&) = delete;
~IsolateHolder();