Don't separate node bindings into renderer and browser part.

Since we are going to use embeding thread to implement message
integration on all platforms, we do not need to separate renderer and
browser anymore.
This commit is contained in:
Cheng Zhao 2013-07-22 16:05:35 +08:00
parent bc62d8c2c5
commit 008b8d404d
11 changed files with 64 additions and 123 deletions

View file

@ -105,8 +105,6 @@
'browser/native_window_win.cc',
'browser/native_window_win.h',
'browser/native_window_observer.h',
'browser/node_bindings_browser_win.cc',
'browser/node_bindings_browser_win.h',
'browser/nsalert_synchronous_sheet.h',
'browser/nsalert_synchronous_sheet.mm',
'browser/window_list.cc',
@ -132,6 +130,8 @@
'common/node_bindings.h',
'common/node_bindings_mac.cc',
'common/node_bindings_mac.h',
'common/node_bindings_win.cc',
'common/node_bindings_win.h',
'common/options_switches.cc',
'common/options_switches.h',
'common/platform_util.h',
@ -147,8 +147,6 @@
'renderer/atom_render_view_observer.h',
'renderer/atom_renderer_client.cc',
'renderer/atom_renderer_client.h',
'renderer/node_bindings_renderer_win.cc',
'renderer/node_bindings_renderer_win.h',
],
'framework_sources': [
'app/atom_library_main.cc',
@ -179,6 +177,10 @@
'mac_framework_dirs': [
'<(atom_source_root)/frameworks',
],
'includes': [
# Rules for excluding e.g. foo_win.cc from the build on non-Windows.
'filename_rules.gypi',
],
},
'targets': [
{

View file

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

View file

@ -1,27 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "browser/node_bindings_browser_win.h"
namespace atom {
NodeBindingsBrowserWin::NodeBindingsBrowserWin()
: NodeBindings(true) {
}
NodeBindingsBrowserWin::~NodeBindingsBrowserWin() {
}
void NodeBindingsBrowserWin::PrepareMessageLoop() {
}
void NodeBindingsBrowserWin::RunMessageLoop() {
}
// static
NodeBindings* NodeBindings::CreateInBrowser() {
return new NodeBindingsBrowserWin();
}
} // namespace atom

View file

@ -1,27 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_NODE_BINDINGS_BROWSER_WIN_H_
#define ATOM_BROWSER_NODE_BINDINGS_BROWSER_WIN_H_
#include "base/compiler_specific.h"
#include "common/node_bindings.h"
namespace atom {
class NodeBindingsBrowserWin : public NodeBindings {
public:
NodeBindingsBrowserWin();
virtual ~NodeBindingsBrowserWin();
virtual void PrepareMessageLoop() OVERRIDE;
virtual void RunMessageLoop() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NodeBindingsBrowserWin);
};
} // namespace atom
#endif // ATOM_BROWSER_NODE_BINDINGS_BROWSER_WIN_H_

View file

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

View file

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

View file

@ -0,0 +1,27 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "common/node_bindings_win.h"
#include "vendor/node/src/node.h"
#include "vendor/node/src/node_internals.h"
namespace atom {
NodeBindingsWin::NodeBindingsWin(bool is_browser)
: NodeBindings(is_browser) {
}
NodeBindingsWin::~NodeBindingsWin() {
}
void NodeBindingsWin::PollEvents() {
}
// static
NodeBindings* NodeBindings::Create(bool is_browser) {
return new NodeBindingsWin(is_browser);
}
} // namespace atom

View file

@ -0,0 +1,26 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_NODE_BINDINGS_WIN_
#define ATOM_COMMON_NODE_BINDINGS_WIN_
#include "base/compiler_specific.h"
#include "common/node_bindings.h"
namespace atom {
class NodeBindingsWin : public NodeBindings {
public:
explicit NodeBindingsWin(bool is_browser);
virtual ~NodeBindingsWin();
private:
virtual void PollEvents() OVERRIDE;
DISALLOW_COPY_AND_ASSIGN(NodeBindingsWin);
};
} // namespace atom
#endif // ATOM_COMMON_NODE_BINDINGS_WIN_

View file

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

View file

@ -1,27 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "renderer/node_bindings_renderer_win.h"
namespace atom {
NodeBindingsRendererWin::NodeBindingsRendererWin()
: NodeBindings(false) {
}
NodeBindingsRendererWin::~NodeBindingsRendererWin() {
}
void NodeBindingsRendererWin::PrepareMessageLoop() {
}
void NodeBindingsRendererWin::RunMessageLoop() {
}
// static
NodeBindings* NodeBindings::CreateInRenderer() {
return new NodeBindingsRendererWin();
}
} // namespace atom

View file

@ -1,27 +0,0 @@
// Copyright (c) 2013 GitHub, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ATOM_RENDERER_NODE_BINDINGS_RENDERER_WIN_H_
#define ATOM_RENDERER_NODE_BINDINGS_RENDERER_WIN_H_
#include "base/compiler_specific.h"
#include "common/node_bindings.h"
namespace atom {
class NodeBindingsRendererWin : public NodeBindings {
public:
NodeBindingsRendererWin();
virtual ~NodeBindingsRendererWin();
virtual void PrepareMessageLoop() OVERRIDE;
virtual void RunMessageLoop() OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(NodeBindingsRendererWin);
};
} // namespace atom
#endif // ATOM_RENDERER_NODE_BINDINGS_RENDERER_WIN_H_