Initailize V8 with gin.

This commit is contained in:
Cheng Zhao 2014-09-01 16:41:26 +08:00
parent d874ba80db
commit 241b07f763
3 changed files with 8 additions and 3 deletions

View file

@ -7,7 +7,9 @@
namespace atom {
JavascriptEnvironment::JavascriptEnvironment()
: isolate_(v8::Isolate::GetCurrent()),
: isolate_holder_(gin::IsolateHolder::kNonStrictMode),
isolate_(isolate_holder_.isolate()),
isolate_scope_(isolate_),
locker_(isolate_),
handle_scope_(isolate_),
context_(isolate_, v8::Context::New(isolate_)),

View file

@ -6,7 +6,7 @@
#define ATOM_BROWSER_JAVASCRIPT_ENVIRONMENT_H_
#include "base/basictypes.h"
#include "v8/include/v8.h"
#include "gin/public/isolate_holder.h"
namespace atom {
@ -20,7 +20,9 @@ class JavascriptEnvironment {
}
private:
gin::IsolateHolder isolate_holder_;
v8::Isolate* isolate_;
v8::Isolate::Scope isolate_scope_;
v8::Locker locker_;
v8::HandleScope handle_scope_;
v8::UniquePersistent<v8::Context> context_;

View file

@ -61,7 +61,6 @@ AtomBindings::AtomBindings() {
call_next_tick_async_.data = this;
uv_async_init(uv_default_loop(), &g_callback_uv_handle, UvOnCallback);
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
}
AtomBindings::~AtomBindings() {
@ -69,6 +68,8 @@ AtomBindings::~AtomBindings() {
void AtomBindings::BindTo(v8::Isolate* isolate,
v8::Handle<v8::Object> process) {
v8::V8::SetFatalErrorHandler(FatalErrorCallback);
mate::Dictionary dict(isolate, process);
dict.SetMethod("crash", &Crash);
dict.SetMethod("log", &Log);