diff options
author | Eugene Ostroukhov <eostroukhov@chromium.org> | 2016-11-18 13:52:22 -0800 |
---|---|---|
committer | Eugene Ostroukhov <eostroukhov@chromium.org> | 2016-12-09 09:07:50 -0800 |
commit | f9aadfbc5adb3b9ee9357636d846dff1556b9acc (patch) | |
tree | 7ec6dded7ce804ac4069d56826cbd55593c9a450 /src/node_debug_options.h | |
parent | bc335c0a8d68164fd978192409ab6c4986cfe374 (diff) | |
download | android-node-v8-f9aadfbc5adb3b9ee9357636d846dff1556b9acc.tar.gz android-node-v8-f9aadfbc5adb3b9ee9357636d846dff1556b9acc.tar.bz2 android-node-v8-f9aadfbc5adb3b9ee9357636d846dff1556b9acc.zip |
inspector: move options parsing
As inspector functionality expands, more options will need to be added.
Currently this requires changing adding function arguments, etc. This
change packs the veriables into a single class that can be extended
without changing APIs.
PR-URL: https://github.com/nodejs/node/pull/9691
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_debug_options.h')
-rw-r--r-- | src/node_debug_options.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/node_debug_options.h b/src/node_debug_options.h new file mode 100644 index 0000000000..d03bdb1549 --- /dev/null +++ b/src/node_debug_options.h @@ -0,0 +1,51 @@ +#ifndef SRC_NODE_DEBUG_OPTIONS_H_ +#define SRC_NODE_DEBUG_OPTIONS_H_ + +#include <string> + +// Forward declaration to break recursive dependency chain with src/env.h. +namespace node { + +enum class DebugAgentType { + kNone, + kDebugger, +#if HAVE_INSPECTOR + kInspector +#endif // HAVE_INSPECTOR +}; + +class DebugOptions { + public: + DebugOptions(); + bool ParseOption(const std::string& option); + bool debugger_enabled() const { + return debugger_enabled_ && !inspector_enabled(); + } + bool inspector_enabled() const { +#if HAVE_INSPECTOR + return inspector_enabled_; +#else + return false; +#endif // HAVE_INSPECTOR + } + void EnableDebugAgent(DebugAgentType type); + bool ToolsServerEnabled(); + bool wait_for_connect() const { return wait_connect_; } + std::string host_name() const { return host_name_; } + int port() const; + void set_port(int port) { port_ = port; } + + private: + bool debugger_enabled_; +#if HAVE_INSPECTOR + bool inspector_enabled_; +#endif // HAVE_INSPECTOR + bool wait_connect_; + bool http_enabled_; + std::string host_name_; + int port_; +}; + +} // namespace node + +#endif // SRC_NODE_DEBUG_OPTIONS_H_ |