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() AtomBrowserMainParts::AtomBrowserMainParts()
: atom_bindings_(new AtomBrowserBindings), : atom_bindings_(new AtomBrowserBindings),
browser_(new Browser), browser_(new Browser),
node_bindings_(NodeBindings::Create(true)) { node_bindings_(NodeBindings::CreateInBrowser()) {
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts"; DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
self_ = this; self_ = this;
} }

View file

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

View file

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

View file

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