Separate LoadEnvironment from CreateEnvironment
This commit is contained in:
parent
854c59df5c
commit
5e58915bdd
4 changed files with 10 additions and 3 deletions
|
@ -63,8 +63,9 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
||||||
// Support the "--debug" switch.
|
// Support the "--debug" switch.
|
||||||
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
|
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
|
||||||
|
|
||||||
// Create the global environment.
|
// Create and load the global environment.
|
||||||
global_env = node_bindings_->CreateEnvironment(js_env_->context());
|
global_env = node_bindings_->CreateEnvironment(js_env_->context());
|
||||||
|
node_bindings_->LoadEnvironment(global_env);
|
||||||
|
|
||||||
// Make sure node can get correct environment when debugging.
|
// Make sure node can get correct environment when debugging.
|
||||||
if (node_debugger_->IsRunning())
|
if (node_debugger_->IsRunning())
|
||||||
|
|
|
@ -247,11 +247,13 @@ node::Environment* NodeBindings::CreateEnvironment(
|
||||||
env->set_process_object(process_object);
|
env->set_process_object(process_object);
|
||||||
|
|
||||||
SetupProcessObject(env, argc, argv, exec_argc, exec_argv);
|
SetupProcessObject(env, argc, argv, exec_argc, exec_argv);
|
||||||
LoadEnvironment(env);
|
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeBindings::LoadEnvironment(node::Environment* env) {
|
||||||
|
node::LoadEnvironment(env);
|
||||||
|
}
|
||||||
|
|
||||||
void NodeBindings::PrepareMessageLoop() {
|
void NodeBindings::PrepareMessageLoop() {
|
||||||
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
|
DCHECK(!is_browser_ || BrowserThread::CurrentlyOn(BrowserThread::UI));
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ class NodeBindings {
|
||||||
// Create the environment and load node.js.
|
// Create the environment and load node.js.
|
||||||
virtual node::Environment* CreateEnvironment(v8::Handle<v8::Context> context);
|
virtual node::Environment* CreateEnvironment(v8::Handle<v8::Context> context);
|
||||||
|
|
||||||
|
// Load node.js in the environment.
|
||||||
|
void LoadEnvironment(node::Environment* env);
|
||||||
|
|
||||||
// Prepare for message loop integration.
|
// Prepare for message loop integration.
|
||||||
virtual void PrepareMessageLoop();
|
virtual void PrepareMessageLoop();
|
||||||
|
|
||||||
|
|
|
@ -148,6 +148,7 @@ void AtomRendererClient::DidCreateScriptContext(blink::WebFrame* frame,
|
||||||
|
|
||||||
// Setup node environment for each window.
|
// Setup node environment for each window.
|
||||||
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
||||||
|
node_bindings_->LoadEnvironment(env);
|
||||||
|
|
||||||
// Add atom-shell extended APIs.
|
// Add atom-shell extended APIs.
|
||||||
atom_bindings_->BindToFrame(frame);
|
atom_bindings_->BindToFrame(frame);
|
||||||
|
|
Loading…
Reference in a new issue