Browse Source

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.
Cheng Zhao 11 years ago
parent
commit
008b8d404d

+ 6 - 4
atom.gyp

@@ -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': [
     {

+ 1 - 1
browser/atom_browser_main_parts.cc

@@ -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;
 }

+ 0 - 27
browser/node_bindings_browser_win.cc

@@ -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

+ 0 - 27
browser/node_bindings_browser_win.h

@@ -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_

+ 1 - 2
common/node_bindings.h

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

+ 2 - 7
common/node_bindings_mac.cc

@@ -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

+ 27 - 0
common/node_bindings_win.cc

@@ -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

+ 26 - 0
common/node_bindings_win.h

@@ -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_

+ 1 - 1
renderer/atom_renderer_client.cc

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

+ 0 - 27
renderer/node_bindings_renderer_win.cc

@@ -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

+ 0 - 27
renderer/node_bindings_renderer_win.h

@@ -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_