src: upgrade to new v8 api

Small change that Context::New requires an isolate and returns Local
instead of Persistent.
pull/5010/head
Trevor Norris 2013-05-22 13:04:41 -07:00
parent e761ac2306
commit 2868bf94b6
2 changed files with 3 additions and 9 deletions

View File

@ -3082,7 +3082,7 @@ int Start(int argc, char *argv[]) {
HandleScope handle_scope(node_isolate); HandleScope handle_scope(node_isolate);
// Create the one and only Context. // Create the one and only Context.
Persistent<Context> context = Context::New(); Local<Context> context = Context::New(node_isolate);
Context::Scope context_scope(context); Context::Scope context_scope(context);
// Use original argv, as we're just copying values out of it. // Use original argv, as we're just copying values out of it.
@ -3102,10 +3102,6 @@ int Start(int argc, char *argv[]) {
EmitExit(process_l); EmitExit(process_l);
RunAtExit(); RunAtExit();
#ifndef NDEBUG
context.Dispose(node_isolate);
#endif
} }
#ifndef NDEBUG #ifndef NDEBUG

View File

@ -165,7 +165,7 @@ Handle<Value> WrappedContext::New(const Arguments& args) {
WrappedContext::WrappedContext() : ObjectWrap() { WrappedContext::WrappedContext() : ObjectWrap() {
context_ = Context::New(); context_ = Persistent<Context>::New(node_isolate, Context::New(node_isolate));
} }
@ -386,9 +386,7 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
// function. Here we grab a temporary handle to the new context, assign it // function. Here we grab a temporary handle to the new context, assign it
// to a local handle, and then dispose the persistent handle. This ensures // to a local handle, and then dispose the persistent handle. This ensures
// that when this function exits the context will be disposed. // that when this function exits the context will be disposed.
Persistent<Context> tmp = Context::New(); context = Context::New(node_isolate);
context = Local<Context>::New(node_isolate, tmp);
tmp.Dispose(node_isolate);
} else if (context_flag == userContext) { } else if (context_flag == userContext) {
// Use the passed in context // Use the passed in context