Don't separate node bindings into renderer and browser part.
authorCheng Zhao <zcbenz@gmail.com>
Mon, 22 Jul 2013 08:05:35 +0000 (16:05 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 22 Jul 2013 08:05:35 +0000 (16:05 +0800)
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.

atom.gyp
browser/atom_browser_main_parts.cc
browser/node_bindings_browser_win.cc [deleted file]
browser/node_bindings_browser_win.h [deleted file]
common/node_bindings.h
common/node_bindings_mac.cc
common/node_bindings_win.cc [new file with mode: 0644]
common/node_bindings_win.h [new file with mode: 0644]
renderer/atom_renderer_client.cc
renderer/node_bindings_renderer_win.cc [deleted file]
renderer/node_bindings_renderer_win.h [deleted file]

index 3846801..c2b1beb 100644 (file)
--- a/atom.gyp
+++ b/atom.gyp
       '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',
       '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',
       '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',
     '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': [
     {
index a23cf36..31fe68f 100644 (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;
 }
diff --git a/browser/node_bindings_browser_win.cc b/browser/node_bindings_browser_win.cc
deleted file mode 100644 (file)
index 17446c2..0000000
+++ /dev/null
@@ -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
diff --git a/browser/node_bindings_browser_win.h b/browser/node_bindings_browser_win.h
deleted file mode 100644 (file)
index a20cc72..0000000
+++ /dev/null
@@ -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_
index 3c2d20a..62d0586 100644 (file)
@@ -20,8 +20,7 @@ namespace atom {
 
 class NodeBindings {
  public:
-  static NodeBindings* CreateInBrowser();
-  static NodeBindings* CreateInRenderer();
+  static NodeBindings* Create(bool is_browser);
 
   virtual ~NodeBindings();
 
index 8aeb251..c092dae 100644 (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
diff --git a/common/node_bindings_win.cc b/common/node_bindings_win.cc
new file mode 100644 (file)
index 0000000..b0eec1b
--- /dev/null
@@ -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
diff --git a/common/node_bindings_win.h b/common/node_bindings_win.h
new file mode 100644 (file)
index 0000000..7a51231
--- /dev/null
@@ -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_
index a22f8a8..36cb405 100644 (file)
@@ -23,7 +23,7 @@ v8::Handle<v8::Context> GetNodeContext() {
 }  // namespace
 
 AtomRendererClient::AtomRendererClient()
-    : node_bindings_(NodeBindings::CreateInRenderer()) {
+    : node_bindings_(NodeBindings::Create(false)) {
 }
 
 AtomRendererClient::~AtomRendererClient() {
diff --git a/renderer/node_bindings_renderer_win.cc b/renderer/node_bindings_renderer_win.cc
deleted file mode 100644 (file)
index 9466732..0000000
+++ /dev/null
@@ -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
diff --git a/renderer/node_bindings_renderer_win.h b/renderer/node_bindings_renderer_win.h
deleted file mode 100644 (file)
index 884766f..0000000
+++ /dev/null
@@ -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_