]> khamidou — GitHub mirrors - electron.git/commitdiff
Use our debugger implementation in Node
authorCheng Zhao <zcbenz@gmail.com>
Thu, 27 Aug 2015 05:16:19 +0000 (13:16 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 27 Aug 2015 05:16:19 +0000 (13:16 +0800)
atom/app/node_main.cc
atom/common/node_bindings.cc

index 8823e583107c0740a2e5cc9580b5203ddb4f9b60..356fe03e139dc78a25d1118d8844609d2d03dcea 100644 (file)
@@ -5,15 +5,18 @@
 #include "atom/app/node_main.h"
 
 #include "atom/browser/javascript_environment.h"
+#include "atom/browser/node_debugger.h"
+#include "atom/common/node_includes.h"
+#include "base/command_line.h"
 #include "gin/array_buffer.h"
 #include "gin/public/isolate_holder.h"
 #include "gin/v8_initializer.h"
 
-#include "atom/common/node_includes.h"
-
 namespace atom {
 
 int NodeMain(int argc, char *argv[]) {
+  base::CommandLine::Init(argc, argv);
+
   argv = uv_setup_args(argc, argv);
   int exec_argc;
   const char** exec_argv;
@@ -31,17 +34,13 @@ int NodeMain(int argc, char *argv[]) {
         gin_env.isolate(), uv_default_loop(), gin_env.context(), argc, argv,
         exec_argc, exec_argv);
 
-    // Start debugger.
-    node::node_isolate = gin_env.isolate();
-    if (node::use_debug_agent)
-      node::StartDebug(env, node::debug_wait_connect);
+    // Start our custom debugger implementation.
+    NodeDebugger node_debugger(gin_env.isolate());
+    if (node_debugger.IsRunning())
+      env->AssignToContext(v8::Debug::GetDebugContext());
 
     node::LoadEnvironment(env);
 
-    // Enable debugger.
-    if (node::use_debug_agent)
-      node::EnableDebug(env);
-
     bool more;
     do {
       more = uv_run(env->event_loop(), UV_RUN_ONCE);
index 827033bbccbcecb74ca5b0f4ef1cd8609fefde81..e6d59f2ed366d1c361c7b55a6d2ba942ad36d208 100644 (file)
@@ -137,11 +137,6 @@ void NodeBindings::Initialize() {
     AtomCommandLine::InitializeFromCommandLine();
 #endif
 
-  // Parse the debug args.
-  auto args = AtomCommandLine::argv();
-  for (const std::string& arg : args)
-    node::ParseDebugOpt(arg.c_str());
-
   // Init node.
   // (we assume node::Init would not modify the parameters under embedded mode).
   node::Init(nullptr, nullptr, nullptr, nullptr);