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.

diff --git a/gin/isolate_holder.cc b/gin/isolate_holder.cc
index e099fd3f03e56bbbf3ceab45edb8f4b8eb0b2b0f..4b362843e4f8f3a1e2abfa152a51554b1d36dd96 100644
--- a/gin/isolate_holder.cc
+++ b/gin/isolate_holder.cc
@@ -46,7 +46,8 @@ IsolateHolder::IsolateHolder(
     scoped_refptr<base::SingleThreadTaskRunner> task_runner,
     AccessMode access_mode,
     AllowAtomicsWaitMode atomics_wait_mode,
-    IsolateCreationMode isolate_creation_mode)
+    IsolateCreationMode isolate_creation_mode,
+    v8::Isolate* isolate)
     : access_mode_(access_mode) {
   DCHECK(task_runner);
   DCHECK(task_runner->BelongsToCurrentThread());
@@ -54,7 +55,11 @@ IsolateHolder::IsolateHolder(
   v8::ArrayBuffer::Allocator* allocator = g_array_buffer_allocator;
   CHECK(allocator) << "You need to invoke gin::IsolateHolder::Initialize first";
 
-  isolate_ = v8::Isolate::Allocate();
+  if (!isolate) {
+    isolate_ = v8::Isolate::Allocate();
+  } else {
+    isolate_ = isolate;
+  }
   isolate_data_.reset(
       new 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 84cf66e6e9cdbfcdc3d8f0a1f0c122e5994ef1c2..cc0d65e4e4be5818d526c0a46a60e1165697cac0 100644
--- a/gin/public/isolate_holder.h
+++ b/gin/public/isolate_holder.h
@@ -66,7 +66,8 @@ class GIN_EXPORT IsolateHolder {
       scoped_refptr<base::SingleThreadTaskRunner> task_runner,
       AccessMode access_mode,
       AllowAtomicsWaitMode atomics_wait_mode,
-      IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal);
+      IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
+      v8::Isolate* isolate = nullptr);
   ~IsolateHolder();
 
   // Should be invoked once before creating IsolateHolder instances to
