![electron-roller[bot]](/assets/img/avatar_default.png)
* chore: bump chromium in DEPS to 133.0.6943.16 * chore: bump chromium in DEPS to 133.0.6943.27 * chore: bump chromium in DEPS to 133.0.6943.35 * chore: bump chromium to 134.0.6968.0 cherry picked from 75eac86506da4fd87aa7ec36478d5c196b988d4f --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
83 lines
3.9 KiB
Diff
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 1bed0865ba952b611985d41b742274861926925d..2be37976a1305f1deed561b3b829dbb5d7ae85e7 100644
|
|
--- a/gin/isolate_holder.cc
|
|
+++ b/gin/isolate_holder.cc
|
|
@@ -76,7 +76,8 @@ IsolateHolder::IsolateHolder(
|
|
v8::CreateHistogramCallback create_histogram_callback,
|
|
v8::AddHistogramSampleCallback add_histogram_sample_callback,
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner,
|
|
- scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner)
|
|
+ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner,
|
|
+ v8::Isolate* isolate)
|
|
: IsolateHolder(std::move(task_runner),
|
|
access_mode,
|
|
isolate_type,
|
|
@@ -86,7 +87,8 @@ IsolateHolder::IsolateHolder(
|
|
add_histogram_sample_callback),
|
|
isolate_creation_mode,
|
|
std::move(user_visible_task_runner),
|
|
- std::move(best_effort_task_runner)) {}
|
|
+ std::move(best_effort_task_runner),
|
|
+ isolate) {}
|
|
|
|
IsolateHolder::IsolateHolder(
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
|
@@ -95,7 +97,8 @@ IsolateHolder::IsolateHolder(
|
|
std::unique_ptr<v8::Isolate::CreateParams> params,
|
|
IsolateCreationMode isolate_creation_mode,
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner,
|
|
- scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner)
|
|
+ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner,
|
|
+ v8::Isolate* isolate)
|
|
: access_mode_(access_mode), isolate_type_(isolate_type) {
|
|
CHECK(Initialized())
|
|
<< "You need to invoke gin::IsolateHolder::Initialize first";
|
|
@@ -106,7 +109,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(user_visible_task_runner), std::move(best_effort_task_runner));
|
|
diff --git a/gin/public/isolate_holder.h b/gin/public/isolate_holder.h
|
|
index d1d178de28c7d46db1c96ba321070612ef5812e1..52b8c1af58678b9fee684ff75340c98fcc73b552 100644
|
|
--- a/gin/public/isolate_holder.h
|
|
+++ b/gin/public/isolate_holder.h
|
|
@@ -87,7 +87,8 @@ class GIN_EXPORT IsolateHolder {
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner =
|
|
nullptr,
|
|
scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner =
|
|
- nullptr);
|
|
+ nullptr,
|
|
+ v8::Isolate* isolate = nullptr);
|
|
IsolateHolder(
|
|
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
|
AccessMode access_mode,
|
|
@@ -97,7 +98,8 @@ class GIN_EXPORT IsolateHolder {
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner =
|
|
nullptr,
|
|
scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner =
|
|
- nullptr);
|
|
+ nullptr,
|
|
+ v8::Isolate* isolate = nullptr);
|
|
IsolateHolder(const IsolateHolder&) = delete;
|
|
IsolateHolder& operator=(const IsolateHolder&) = delete;
|
|
~IsolateHolder();
|