refactor: remove use of Node's DebugOptions (#22083)
This commit is contained in:
parent
099246f0e4
commit
d5e7904610
6 changed files with 16 additions and 147 deletions
|
@ -7,7 +7,6 @@ expose_get_builtin_module_function.patch
|
|||
fix_build_and_expose_inspector_agent.patch
|
||||
fix_expose_internalcallbackscope.patch
|
||||
build_add_gn_build_files.patch
|
||||
fix_export_debugoptions.patch
|
||||
fix_add_default_values_for_enable_lto_and_build_v8_with_gn_in.patch
|
||||
feat_add_new_built_with_electron_variable_to_config_gypi.patch
|
||||
feat_add_flags_for_low-level_hooks_and_exceptions.patch
|
||||
|
@ -18,7 +17,6 @@ fixme_use_redefined_version_of_internalmodulestat.patch
|
|||
fixme_remove_async_id_assertion_check.patch
|
||||
fixme_comment_trace_event_macro.patch
|
||||
fix_key_gen_apis_are_not_available_in_boringssl.patch
|
||||
fix_do_not_define_debugoptions_s_constructors_in_header.patch
|
||||
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch
|
||||
refactor_allow_embedder_overriding_of_internal_fs_calls.patch
|
||||
chore_prevent_warn_non_context-aware_native_modules_being_loaded.patch
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Cheng Zhao <zcbenz@gmail.com>
|
||||
Date: Fri, 29 Mar 2019 17:17:30 +0900
|
||||
Subject: fix: do not define DebugOptions's constructors in header
|
||||
|
||||
The e3ca89ef49 changed NODE_EXTERN to always expose symbols for
|
||||
DebugOptions, and since the constructors of DebugOptions are defined in
|
||||
header, the compiler would end up generating no constructor
|
||||
implementations for DebugOptions.
|
||||
|
||||
Which means we would encounter crash when constructors of DebugOptions
|
||||
is called.
|
||||
|
||||
By putting the definitions of constructors into the implementation file,
|
||||
we can avoid this problem.
|
||||
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index 2dd90e9a8cf9381c8608b73ead247bcf86b72ab9..051e7b084b6770215bd009b0e37feabbb7df7389 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -26,6 +26,12 @@ Mutex cli_options_mutex;
|
||||
std::shared_ptr<PerProcessOptions> cli_options{new PerProcessOptions()};
|
||||
} // namespace per_process
|
||||
|
||||
+DebugOptions::DebugOptions() = default;
|
||||
+DebugOptions::DebugOptions(const DebugOptions&) = default;
|
||||
+DebugOptions::DebugOptions(DebugOptions&&) = default;
|
||||
+DebugOptions& DebugOptions::operator=(const DebugOptions&) = default;
|
||||
+DebugOptions& DebugOptions::operator=(DebugOptions&&) = default;
|
||||
+
|
||||
void DebugOptions::CheckOptions(std::vector<std::string>* errors) {
|
||||
#if !NODE_USE_V8_PLATFORM && !HAVE_INSPECTOR
|
||||
if (inspector_enabled) {
|
||||
diff --git a/src/node_options.h b/src/node_options.h
|
||||
index 40c19ea6ff4d98a1a1da59bca76087209445af81..4ce5551284bb5b1b4194905a9fe619f852933405 100644
|
||||
--- a/src/node_options.h
|
||||
+++ b/src/node_options.h
|
||||
@@ -61,11 +61,11 @@ struct InspectPublishUid {
|
||||
// per-Isolate, rather than per-Environment.
|
||||
class NODE_EXTERN DebugOptions : public Options {
|
||||
public:
|
||||
- DebugOptions() = default;
|
||||
- DebugOptions(const DebugOptions&) = default;
|
||||
- DebugOptions& operator=(const DebugOptions&) = default;
|
||||
- DebugOptions(DebugOptions&&) = default;
|
||||
- DebugOptions& operator=(DebugOptions&&) = default;
|
||||
+ DebugOptions();
|
||||
+ DebugOptions(const DebugOptions&);
|
||||
+ DebugOptions& operator=(const DebugOptions&);
|
||||
+ DebugOptions(DebugOptions&&);
|
||||
+ DebugOptions& operator=(DebugOptions&&);
|
||||
|
||||
// --inspect
|
||||
bool inspector_enabled = false;
|
|
@ -1,57 +0,0 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Nitish Sakhawalkar <nitsakh@icloud.com>
|
||||
Date: Thu, 11 Apr 2019 11:50:49 -0700
|
||||
Subject: fix: export DebugOptions
|
||||
|
||||
This exports DebugOptions so we can parse args like `--inspect-brk`.
|
||||
|
||||
diff --git a/src/node_options.cc b/src/node_options.cc
|
||||
index 35cac18a916c2ce104a3e7b6760d0280b33c2892..2dd90e9a8cf9381c8608b73ead247bcf86b72ab9 100644
|
||||
--- a/src/node_options.cc
|
||||
+++ b/src/node_options.cc
|
||||
@@ -210,11 +210,6 @@ void EnvironmentOptions::CheckOptions(std::vector<std::string>* errors) {
|
||||
|
||||
namespace options_parser {
|
||||
|
||||
-class DebugOptionsParser : public OptionsParser<DebugOptions> {
|
||||
- public:
|
||||
- DebugOptionsParser();
|
||||
-};
|
||||
-
|
||||
class EnvironmentOptionsParser : public OptionsParser<EnvironmentOptions> {
|
||||
public:
|
||||
EnvironmentOptionsParser();
|
||||
diff --git a/src/node_options.h b/src/node_options.h
|
||||
index 8937bfd9011e4795d22e232886e18183d698b8d4..40c19ea6ff4d98a1a1da59bca76087209445af81 100644
|
||||
--- a/src/node_options.h
|
||||
+++ b/src/node_options.h
|
||||
@@ -59,7 +59,7 @@ struct InspectPublishUid {
|
||||
// to keep them separate since they are a group of options applying to a very
|
||||
// specific part of Node. It might also make more sense for them to be
|
||||
// per-Isolate, rather than per-Environment.
|
||||
-class DebugOptions : public Options {
|
||||
+class NODE_EXTERN DebugOptions : public Options {
|
||||
public:
|
||||
DebugOptions() = default;
|
||||
DebugOptions(const DebugOptions&) = default;
|
||||
@@ -244,7 +244,7 @@ class PerProcessOptions : public Options {
|
||||
|
||||
namespace options_parser {
|
||||
|
||||
-HostPort SplitHostPort(const std::string& arg,
|
||||
+HostPort NODE_EXTERN SplitHostPort(const std::string& arg,
|
||||
std::vector<std::string>* errors);
|
||||
void GetOptions(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
|
||||
@@ -437,6 +437,11 @@ class OptionsParser {
|
||||
friend void GetOptions(const v8::FunctionCallbackInfo<v8::Value>& args);
|
||||
};
|
||||
|
||||
+class NODE_EXTERN DebugOptionsParser : public OptionsParser<DebugOptions> {
|
||||
+ public:
|
||||
+ DebugOptionsParser();
|
||||
+};
|
||||
+
|
||||
using StringVector = std::vector<std::string>;
|
||||
template <class OptionsType, class = Options>
|
||||
void Parse(
|
Loading…
Add table
Add a link
Reference in a new issue