src: pass the v8::Context to CreateEnvironment
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>
This commit is contained in:
parent
c4e5fde362
commit
da30c0084a
@ -3527,13 +3527,13 @@ int EmitExit(Environment* env) {
|
|||||||
|
|
||||||
|
|
||||||
Environment* CreateEnvironment(Isolate* isolate,
|
Environment* CreateEnvironment(Isolate* isolate,
|
||||||
|
Handle<Context> context,
|
||||||
int argc,
|
int argc,
|
||||||
const char* const* argv,
|
const char* const* argv,
|
||||||
int exec_argc,
|
int exec_argc,
|
||||||
const char* const* exec_argv) {
|
const char* const* exec_argv) {
|
||||||
HandleScope handle_scope(isolate);
|
HandleScope handle_scope(isolate);
|
||||||
|
|
||||||
Local<Context> context = Context::New(isolate);
|
|
||||||
Context::Scope context_scope(context);
|
Context::Scope context_scope(context);
|
||||||
Environment* env = Environment::New(context);
|
Environment* env = Environment::New(context);
|
||||||
|
|
||||||
@ -3605,8 +3605,10 @@ int Start(int argc, char** argv) {
|
|||||||
V8::Initialize();
|
V8::Initialize();
|
||||||
{
|
{
|
||||||
Locker locker(node_isolate);
|
Locker locker(node_isolate);
|
||||||
Environment* env =
|
HandleScope handle_scope(node_isolate);
|
||||||
CreateEnvironment(node_isolate, argc, argv, exec_argc, exec_argv);
|
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
|
// Assign env to the debugger's context
|
||||||
if (debugger_running) {
|
if (debugger_running) {
|
||||||
HandleScope scope(env->isolate());
|
HandleScope scope(env->isolate());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user