mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
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:
@@ -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
|
||||
|
||||
@@ -20,6 +20,9 @@ class JavascriptEnvironment {
|
||||
}
|
||||
|
||||
private:
|
||||
bool Initialize();
|
||||
|
||||
bool initialized_;
|
||||
gin::IsolateHolder isolate_holder_;
|
||||
v8::Isolate* isolate_;
|
||||
v8::Isolate::Scope isolate_scope_;
|
||||
|
||||
Reference in New Issue
Block a user