Wrap uv loop with web page context in renderer.
This commit is contained in:
parent
968fc71b78
commit
e7b7efeb0a
3 changed files with 21 additions and 3 deletions
|
@ -51,10 +51,13 @@ void AtomRendererClient::DidCreateScriptContext(WebKit::WebFrame* frame,
|
|||
node_bindings_->RunMessageLoop();
|
||||
|
||||
// Setup node environment for each window.
|
||||
node_bindings_->CreateEnvironment(context);
|
||||
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
||||
|
||||
// Add atom-shell extended APIs.
|
||||
atom_bindings_->BindToFrame(frame);
|
||||
|
||||
// Make uv loop being wrapped by window context.
|
||||
node_bindings_->set_uv_env(env);
|
||||
}
|
||||
|
||||
void AtomRendererClient::WillReleaseScriptContext(
|
||||
|
@ -67,6 +70,9 @@ void AtomRendererClient::WillReleaseScriptContext(
|
|||
return;
|
||||
}
|
||||
|
||||
if (env == node_bindings_->get_uv_env())
|
||||
node_bindings_->set_uv_env(NULL);
|
||||
|
||||
env->Dispose();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue