Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
src: pass the v8::Context to CreateEnvironment
Browse files Browse the repository at this point in the history
Pass in the v8::Context, instead of creating it
within CreateEnvironment.  This allows callers
to use a pre-existing context.

Signed-off-by: Fedor Indutny <fedor@indutny.com>
  • Loading branch information
deanm authored and indutny committed Jul 13, 2014
1 parent c4e5fde commit da30c00
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3527,13 +3527,13 @@ int EmitExit(Environment* env) {


Environment* CreateEnvironment(Isolate* isolate,
Handle<Context> context,
int argc,
const char* const* argv,
int exec_argc,
const char* const* exec_argv) {
HandleScope handle_scope(isolate);

Local<Context> context = Context::New(isolate);
Context::Scope context_scope(context);
Environment* env = Environment::New(context);

Expand Down Expand Up @@ -3605,8 +3605,10 @@ int Start(int argc, char** argv) {
V8::Initialize();
{
Locker locker(node_isolate);
Environment* env =
CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
HandleScope handle_scope(node_isolate);
Local<Context> context = Context::New(node_isolate);
Environment* env = CreateEnvironment(
node_isolate, context, argc, argv, exec_argc, exec_argv);
// Assign env to the debugger's context
if (debugger_running) {
HandleScope scope(env->isolate());
Expand Down

0 comments on commit da30c00

Please sign in to comment.