diff --git a/atom/browser/javascript_environment.cc b/atom/browser/javascript_environment.cc index f8dd71f471e..887c59353ae 100644 --- a/atom/browser/javascript_environment.cc +++ b/atom/browser/javascript_environment.cc @@ -4,10 +4,13 @@ #include "atom/browser/javascript_environment.h" +#include "gin/array_buffer.h" + namespace atom { JavascriptEnvironment::JavascriptEnvironment() - : isolate_(isolate_holder_.isolate()), + : initialized_(Initialize()), + isolate_(isolate_holder_.isolate()), isolate_scope_(isolate_), locker_(isolate_), handle_scope_(isolate_), @@ -15,4 +18,11 @@ JavascriptEnvironment::JavascriptEnvironment() context_scope_(v8::Local::New(isolate_, context_)) { } +bool JavascriptEnvironment::Initialize() { + gin::IsolateHolder::LoadV8Snapshot(); + gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, + gin::ArrayBufferAllocator::SharedInstance()); + return true; +} + } // namespace atom diff --git a/atom/browser/javascript_environment.h b/atom/browser/javascript_environment.h index 8baec7e3681..20f1667c3b8 100644 --- a/atom/browser/javascript_environment.h +++ b/atom/browser/javascript_environment.h @@ -20,6 +20,9 @@ class JavascriptEnvironment { } private: + bool Initialize(); + + bool initialized_; gin::IsolateHolder isolate_holder_; v8::Isolate* isolate_; v8::Isolate::Scope isolate_scope_;