Separate the creation function of NodeBindings for renderer and browser.

On Windows the message loop integration would need two different
implementations.
This commit is contained in:
Cheng Zhao 2013-07-04 19:47:48 +08:00
parent d82f2dd835
commit 8bdf06131b
4 changed files with 11 additions and 5 deletions

View file

@ -20,7 +20,7 @@ AtomBrowserMainParts* AtomBrowserMainParts::self_ = NULL;
AtomBrowserMainParts::AtomBrowserMainParts()
: atom_bindings_(new AtomBrowserBindings),
browser_(new Browser),
node_bindings_(NodeBindings::Create(true)) {
node_bindings_(NodeBindings::CreateInBrowser()) {
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
self_ = this;
}

View file

@ -15,7 +15,8 @@ namespace atom {
class NodeBindings {
public:
static NodeBindings* Create(bool is_browser);
static NodeBindings* CreateInBrowser();
static NodeBindings* CreateInRenderer();
virtual ~NodeBindings();

View file

@ -123,8 +123,13 @@ void NodeBindingsMac::OnWatcherQueueChanged(uv_loop_t* loop) {
}
// static
NodeBindings* NodeBindings::Create(bool is_browser) {
return new NodeBindingsMac(is_browser);
NodeBindings* NodeBindings::CreateInBrowser() {
return new NodeBindingsMac(true);
}
// static
NodeBindings* NodeBindings::CreateInRenderer() {
return new NodeBindingsMac(false);
}
} // namespace atom

View file

@ -23,7 +23,7 @@ v8::Handle<v8::Context> GetNodeContext() {
} // namespace
AtomRendererClient::AtomRendererClient()
: node_bindings_(NodeBindings::Create(false)) {
: node_bindings_(NodeBindings::CreateInRenderer()) {
}
AtomRendererClient::~AtomRendererClient() {