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:
parent
01e891652f
commit
d1685f79a2
2 changed files with 14 additions and 1 deletions
|
@ -4,10 +4,13 @@
|
||||||
|
|
||||||
#include "atom/browser/javascript_environment.h"
|
#include "atom/browser/javascript_environment.h"
|
||||||
|
|
||||||
|
#include "gin/array_buffer.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
JavascriptEnvironment::JavascriptEnvironment()
|
JavascriptEnvironment::JavascriptEnvironment()
|
||||||
: isolate_(isolate_holder_.isolate()),
|
: initialized_(Initialize()),
|
||||||
|
isolate_(isolate_holder_.isolate()),
|
||||||
isolate_scope_(isolate_),
|
isolate_scope_(isolate_),
|
||||||
locker_(isolate_),
|
locker_(isolate_),
|
||||||
handle_scope_(isolate_),
|
handle_scope_(isolate_),
|
||||||
|
@ -15,4 +18,11 @@ JavascriptEnvironment::JavascriptEnvironment()
|
||||||
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {
|
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
|
} // namespace atom
|
||||||
|
|
|
@ -20,6 +20,9 @@ class JavascriptEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool Initialize();
|
||||||
|
|
||||||
|
bool initialized_;
|
||||||
gin::IsolateHolder isolate_holder_;
|
gin::IsolateHolder isolate_holder_;
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
v8::Isolate::Scope isolate_scope_;
|
v8::Isolate::Scope isolate_scope_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue