chore: remove custom Node.js debugger (#25587)
This commit is contained in:
parent
b980d1bd6b
commit
b807cabe1b
10 changed files with 32 additions and 209 deletions
|
@ -41,7 +41,6 @@
|
|||
#include "shell/browser/feature_list.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/media/media_capture_devices_dispatcher.h"
|
||||
#include "shell/browser/node_debugger.h"
|
||||
#include "shell/browser/ui/devtools_manager_delegate.h"
|
||||
#include "shell/common/api/electron_bindings.h"
|
||||
#include "shell/common/application_info.h"
|
||||
|
@ -322,10 +321,6 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
|
|||
js_env_->context(), js_env_->platform());
|
||||
node_env_ = std::make_unique<NodeEnvironment>(env);
|
||||
|
||||
// Enable support for v8 inspector
|
||||
node_debugger_ = std::make_unique<NodeDebugger>(env);
|
||||
node_debugger_->Start();
|
||||
|
||||
env->set_trace_sync_io(env->options()->trace_sync_io);
|
||||
|
||||
// Add Electron extended APIs.
|
||||
|
@ -550,7 +545,6 @@ void ElectronBrowserMainParts::PostMainMessageLoopRun() {
|
|||
|
||||
// Destroy node platform after all destructors_ are executed, as they may
|
||||
// invoke Node/V8 APIs inside them.
|
||||
node_debugger_->Stop();
|
||||
node_env_->env()->set_trace_sync_io(false);
|
||||
js_env_->OnMessageLoopDestroying();
|
||||
node::Stop(node_env_->env());
|
||||
|
|
|
@ -42,7 +42,6 @@ class Browser;
|
|||
class ElectronBindings;
|
||||
class JavascriptEnvironment;
|
||||
class NodeBindings;
|
||||
class NodeDebugger;
|
||||
class NodeEnvironment;
|
||||
class BridgeTaskRunner;
|
||||
|
||||
|
@ -151,7 +150,6 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
|||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
std::unique_ptr<NodeEnvironment> node_env_;
|
||||
std::unique_ptr<NodeDebugger> node_debugger_;
|
||||
std::unique_ptr<IconManager> icon_manager_;
|
||||
std::unique_ptr<base::FieldTrialList> field_trial_list_;
|
||||
|
||||
|
|
|
@ -1,55 +0,0 @@
|
|||
// Copyright (c) 2014 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "shell/browser/node_debugger.h"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "libplatform/libplatform.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
NodeDebugger::NodeDebugger(node::Environment* env) : env_(env) {}
|
||||
|
||||
NodeDebugger::~NodeDebugger() = default;
|
||||
|
||||
void NodeDebugger::Start() {
|
||||
auto* inspector = env_->inspector_agent();
|
||||
if (inspector == nullptr)
|
||||
return;
|
||||
|
||||
// DebugOptions will already have been set by ProcessGlobalArgs,
|
||||
// so just pull the ones from there to pass to the InspectorAgent
|
||||
const auto debug_options = env_->options()->debug_options();
|
||||
if (inspector->Start("" /* path */, debug_options,
|
||||
std::make_shared<node::ExclusiveAccess<node::HostPort>>(
|
||||
debug_options.host_port),
|
||||
true /* is_main */))
|
||||
DCHECK(inspector->IsListening());
|
||||
|
||||
v8::HandleScope handle_scope(env_->isolate());
|
||||
node::profiler::StartProfilers(env_);
|
||||
|
||||
if (inspector->options().break_node_first_line) {
|
||||
inspector->PauseOnNextJavascriptStatement("Break at bootstrap");
|
||||
}
|
||||
}
|
||||
|
||||
void NodeDebugger::Stop() {
|
||||
auto* inspector = env_->inspector_agent();
|
||||
if (inspector && inspector->IsListening()) {
|
||||
inspector->WaitForDisconnect();
|
||||
inspector->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace electron
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2014 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_BROWSER_NODE_DEBUGGER_H_
|
||||
#define SHELL_BROWSER_NODE_DEBUGGER_H_
|
||||
|
||||
#include "base/macros.h"
|
||||
|
||||
namespace node {
|
||||
class Environment;
|
||||
} // namespace node
|
||||
|
||||
namespace electron {
|
||||
|
||||
// Add support for node's "--inspect" switch.
|
||||
class NodeDebugger {
|
||||
public:
|
||||
explicit NodeDebugger(node::Environment* env);
|
||||
~NodeDebugger();
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
|
||||
private:
|
||||
node::Environment* env_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(NodeDebugger);
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
#endif // SHELL_BROWSER_NODE_DEBUGGER_H_
|
Loading…
Add table
Add a link
Reference in a new issue