electron/patches/chromium/isolate_holder.patch
electron-roller[bot] c5b9f766f3
chore: bump chromium to 117.0.5923.0 (main) (#39304)
* chore: bump chromium in DEPS to 117.0.5921.0

* chore: update chromium patches

* 4721409: Remove redundant ARC configuration in /components | https://chromium-review.googlesource.com/c/chromium/src/+/4721409

* 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750

* 4022621: Re-register status item when owner of status watcher is changed | https://chromium-review.googlesource.com/c/chromium/src/+/4022621

* chore: update V8/boringssl patches

* fixup! 4643750: Add V8_LOW_PRIORITY_TQ for main thread | https://chromium-review.googlesource.com/c/chromium/src/+/4643750

* chore: bump chromium in DEPS to 117.0.5923.0

* build [debug]: remove assert
4722125: Update enterprise content analysis buildflags usage | https://chromium-review.googlesource.com/c/chromium/src/+/4722125

* chore: manually rollback to 117.0.5921.0

* build [arc]: ARC conversion in auto_updater

* build [arc]: ARC conversion in browser/api

* build [arc]: ARC conversion in notifications/mac

* build [arc]: ARC conversion in in_app_purchase

* build [arc]: ARC conversion in browser/ui

* build [arc]: ARC conversion in ui/cocoa

* build [arc]: ARC conversion in shell/common

* build [arc]: ARC conversion in OSR

* build [arc]: ARC conversion in login_helper

* build [arc]: ARC conversion in app_mas

* build [arc]: fix up ARC syntax (thanks @codebytere!)

* 4726946: [Extensions] Work around dangling BrowserContext pointer. | https://chromium-review.googlesource.com/c/chromium/src/+/4726946

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <vertedinde@electronjs.org>
Co-authored-by: VerteDinde <keeleymhammond@gmail.com>
2023-08-04 10:47:29 +02:00

83 lines
3.9 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 1c3536a183aad1965e834b1681e36a3fc46ae419..1923f18cf2d4fff5094e6fe60bbef06b3e2cb06b 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -73,7 +73,8 @@ IsolateHolder::IsolateHolder(
IsolateCreationMode isolate_creation_mode,
v8::CreateHistogramCallback create_histogram_callback,
v8::AddHistogramSampleCallback add_histogram_sample_callback,
- scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner)
+ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner,
+ v8::Isolate* isolate)
: IsolateHolder(std::move(task_runner),
access_mode,
isolate_type,
@@ -82,7 +83,8 @@ IsolateHolder::IsolateHolder(
create_histogram_callback,
add_histogram_sample_callback),
isolate_creation_mode,
- std::move(low_priority_task_runner)) {}
+ std::move(low_priority_task_runner),
+ isolate) {}
IsolateHolder::IsolateHolder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
@@ -90,7 +92,8 @@ IsolateHolder::IsolateHolder(
IsolateType isolate_type,
std::unique_ptr<v8::Isolate::CreateParams> params,
IsolateCreationMode isolate_creation_mode,
- scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner)
+ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner,
+ v8::Isolate* isolate)
: access_mode_(access_mode), isolate_type_(isolate_type) {
CHECK(Initialized())
<< "You need to invoke gin::IsolateHolder::Initialize first";
@@ -101,7 +104,7 @@ IsolateHolder::IsolateHolder(
v8::ArrayBuffer::Allocator* allocator = params->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,
std::move(low_priority_task_runner));
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
index a5db8841773618814ac90f740201d4d7e9057b3c..1368ab8bfbf9e69437b394a8376bf7c956ca13ce 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -85,7 +85,8 @@ class GIN_EXPORT IsolateHolder {
v8::CreateHistogramCallback create_histogram_callback = nullptr,
v8::AddHistogramSampleCallback add_histogram_sample_callback = nullptr,
scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner =
- nullptr);
+ nullptr,
+ v8::Isolate* isolate = nullptr);
IsolateHolder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
AccessMode access_mode,
@@ -93,7 +94,8 @@ class GIN_EXPORT IsolateHolder {
std::unique_ptr<v8::Isolate::CreateParams> params,
IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner =
- nullptr);
+ nullptr,
+ v8::Isolate* isolate = nullptr);
IsolateHolder(const IsolateHolder&) = delete;
IsolateHolder& operator=(const IsolateHolder&) = delete;
~IsolateHolder();