diff --git a/atom/browser/javascript_environment.cc b/atom/browser/javascript_environment.cc index b7e3aae20aaf..a1e824cad315 100644 --- a/atom/browser/javascript_environment.cc +++ b/atom/browser/javascript_environment.cc @@ -8,6 +8,7 @@ #include "base/command_line.h" #include "base/message_loop/message_loop.h" +#include "base/task_scheduler/initialization_util.h" #include "base/threading/thread_task_runner_handle.h" #include "content/public/common/content_switches.h" #include "gin/array_buffer.h" @@ -44,9 +45,17 @@ bool JavascriptEnvironment::Initialize() { if (!js_flags.empty()) v8::V8::SetFlagsFromString(js_flags.c_str(), js_flags.size()); + // The V8Platform of gin relies on Chromium's task schedule, which has not + // been started at this point, so we have to rely on Node's V8Platform. + platform_ = node::CreatePlatform( + base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), + uv_default_loop(), nullptr); + v8::V8::InitializePlatform(platform_); + gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::kStableV8Extras, - gin::ArrayBufferAllocator::SharedInstance()); + gin::ArrayBufferAllocator::SharedInstance(), + false); return true; } diff --git a/atom/browser/javascript_environment.h b/atom/browser/javascript_environment.h index 43a7295f9026..e757d9ec4ae5 100644 --- a/atom/browser/javascript_environment.h +++ b/atom/browser/javascript_environment.h @@ -10,6 +10,7 @@ namespace node { class Environment; +class NodePlatform; } namespace atom { @@ -30,6 +31,9 @@ class JavascriptEnvironment { private: bool Initialize(); + // Leaked on exit. + node::NodePlatform* platform_; + bool initialized_; gin::IsolateHolder isolate_holder_; v8::Isolate* isolate_; diff --git a/vendor/libchromiumcontent b/vendor/libchromiumcontent index 5b358f66a994..734f8be87b49 160000 --- a/vendor/libchromiumcontent +++ b/vendor/libchromiumcontent @@ -1 +1 @@ -Subproject commit 5b358f66a9948225e006fa3807213edf6e604409 +Subproject commit 734f8be87b4962386f532b9b2ea35c6ac0cb9f44