Initialize V8 in browser process

Previously it was initialized by ProxyResolverV8, but after Chrome 43 V8
started to initialize V8 lazily.
This commit is contained in:
Cheng Zhao 2015-05-22 15:30:02 +08:00
parent 01e891652f
commit d1685f79a2
2 changed files with 14 additions and 1 deletions

View file

@ -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<v8::Context>::New(isolate_, context_)) {
}
bool JavascriptEnvironment::Initialize() {
gin::IsolateHolder::LoadV8Snapshot();
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
gin::ArrayBufferAllocator::SharedInstance());
return true;
}
} // namespace atom

View file

@ -20,6 +20,9 @@ class JavascriptEnvironment {
}
private:
bool Initialize();
bool initialized_;
gin::IsolateHolder isolate_holder_;
v8::Isolate* isolate_;
v8::Isolate::Scope isolate_scope_;