summaryrefslogtreecommitdiff
path: root/src/inspector_agent.h
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2018-08-10 02:45:28 +0200
committerAnna Henningsen <anna@addaleax.net>2018-08-22 23:37:19 +0200
commit29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7 (patch)
tree1d66e5b012218ede32c5219d9918d2e2a897ee7b /src/inspector_agent.h
parent92880f31da1eca98a42e0f61708b10d9d8d83955 (diff)
downloadandroid-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.tar.gz
android-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.tar.bz2
android-node-v8-29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7.zip
src: refactor options parsing
This is a major refactor of our Node’s parser. See `node_options.cc` for how it is used, and `node_options-inl.h` for the bulk of its implementation. Unfortunately, the implementation has come to have some complexity, in order to meet the following goals: - Make it easy to *use* for defining or changing options. - Keep it (mostly) backwards-compatible. - No tests were harmed as part of this commit. - Be as consistent as possible. - In particular, options can now generally accept arguments through both `--foo=bar` notation and `--foo bar` notation. We were previously very inconsistent on this point. - Separate into different levels of scope, namely per-process (global), per-Isolate and per-Environment (+ debug options). - Allow programmatic accessibility in the future. - This includes a possible expansion for `--help` output. This commit also leaves a number of `TODO` comments, mostly for improving consistency even more (possibly with having to modify tests), improving embedder support, as well as removing pieces of exposed configuration variables that should never have become part of the public API but unfortunately are at this point. PR-URL: https://github.com/nodejs/node/pull/22392 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
Diffstat (limited to 'src/inspector_agent.h')
-rw-r--r--src/inspector_agent.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/inspector_agent.h b/src/inspector_agent.h
index dcd6e13aba..4e32d3ef1a 100644
--- a/src/inspector_agent.h
+++ b/src/inspector_agent.h
@@ -9,7 +9,7 @@
#error("This header can only be used when inspector is enabled")
#endif
-#include "node_debug_options.h"
+#include "node_options.h"
#include "node_persistent.h"
#include "v8.h"
@@ -45,7 +45,7 @@ class Agent {
~Agent();
// Create client_, may create io_ if option enabled
- bool Start(const std::string& path, const DebugOptions& options);
+ bool Start(const std::string& path, std::shared_ptr<DebugOptions> options);
// Stop and destroy io_
void Stop();
@@ -96,7 +96,7 @@ class Agent {
// Calls StartIoThread() from off the main thread.
void RequestIoThreadStart();
- DebugOptions& options() { return debug_options_; }
+ std::shared_ptr<DebugOptions> options() { return debug_options_; }
void ContextCreated(v8::Local<v8::Context> context, const ContextInfo& info);
private:
@@ -109,7 +109,7 @@ class Agent {
// Interface for transports, e.g. WebSocket server
std::unique_ptr<InspectorIo> io_;
std::string path_;
- DebugOptions debug_options_;
+ std::shared_ptr<DebugOptions> debug_options_;
bool pending_enable_async_hook_ = false;
bool pending_disable_async_hook_ = false;