Initailize V8 with gin.
This commit is contained in:
parent
d874ba80db
commit
241b07f763
3 changed files with 8 additions and 3 deletions
|
@ -7,7 +7,9 @@
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
JavascriptEnvironment::JavascriptEnvironment()
|
JavascriptEnvironment::JavascriptEnvironment()
|
||||||
: isolate_(v8::Isolate::GetCurrent()),
|
: isolate_holder_(gin::IsolateHolder::kNonStrictMode),
|
||||||
|
isolate_(isolate_holder_.isolate()),
|
||||||
|
isolate_scope_(isolate_),
|
||||||
locker_(isolate_),
|
locker_(isolate_),
|
||||||
handle_scope_(isolate_),
|
handle_scope_(isolate_),
|
||||||
context_(isolate_, v8::Context::New(isolate_)),
|
context_(isolate_, v8::Context::New(isolate_)),
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
|
||||||
|
|
||||||
#include "base/basictypes.h"
|
#include "base/basictypes.h"
|
||||||
#include "v8/include/v8.h"
|
#include "gin/public/isolate_holder.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
|
@ -20,7 +20,9 @@ class JavascriptEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
gin::IsolateHolder isolate_holder_;
|
||||||
v8::Isolate* isolate_;
|
v8::Isolate* isolate_;
|
||||||
|
v8::Isolate::Scope isolate_scope_;
|
||||||
v8::Locker locker_;
|
v8::Locker locker_;
|
||||||
v8::HandleScope handle_scope_;
|
v8::HandleScope handle_scope_;
|
||||||
v8::UniquePersistent<v8::Context> context_;
|
v8::UniquePersistent<v8::Context> context_;
|
||||||
|
|
|
@ -61,7 +61,6 @@ AtomBindings::AtomBindings() {
|
||||||
call_next_tick_async_.data = this;
|
call_next_tick_async_.data = this;
|
||||||
|
|
||||||
uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
|
uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
|
||||||
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomBindings::~AtomBindings() {
|
AtomBindings::~AtomBindings() {
|
||||||
|
@ -69,6 +68,8 @@ AtomBindings::~AtomBindings() {
|
||||||
|
|
||||||
void AtomBindings::BindTo(v8::Isolate* isolate,
|
void AtomBindings::BindTo(v8::Isolate* isolate,
|
||||||
v8::Handle<v8::Object> process) {
|
v8::Handle<v8::Object> process) {
|
||||||
|
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
|
||||||
|
|
||||||
mate::Dictionary dict(isolate, process);
|
mate::Dictionary dict(isolate, process);
|
||||||
dict.SetMethod("crash", &Crash);
|
dict.SetMethod("crash", &Crash);
|
||||||
dict.SetMethod("log", &Log);
|
dict.SetMethod("log", &Log);
|
||||||
|
|
Loading…
Reference in a new issue