diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-08-10 03:45:28 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-08-23 00:37:19 +0300 |
commit | 29a71bae40ffa0bbc8ba6b2bdf051a09987da7f7 (patch) | |
tree | 1d66e5b012218ede32c5219d9918d2e2a897ee7b /src/inspector_io.cc | |
parent | 92880f31da1eca98a42e0f61708b10d9d8d83955 (diff) |
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_io.cc')
-rw-r--r-- | src/inspector_io.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/inspector_io.cc b/src/inspector_io.cc index 41fea546a83..da44d55d06e 100644 --- a/src/inspector_io.cc +++ b/src/inspector_io.cc @@ -242,7 +242,7 @@ class InspectorIoDelegate: public node::inspector::SocketServerDelegate { std::unique_ptr<InspectorIo> InspectorIo::Start( std::shared_ptr<MainThreadHandle> main_thread, const std::string& path, - const DebugOptions& options) { + std::shared_ptr<DebugOptions> options) { auto io = std::unique_ptr<InspectorIo>( new InspectorIo(main_thread, path, options)); if (io->request_queue_->Expired()) { // Thread is not running @@ -253,7 +253,7 @@ std::unique_ptr<InspectorIo> InspectorIo::Start( InspectorIo::InspectorIo(std::shared_ptr<MainThreadHandle> main_thread, const std::string& path, - const DebugOptions& options) + std::shared_ptr<DebugOptions> options) : main_thread_(main_thread), options_(options), thread_(), script_name_(path), id_(GenerateID()) { Mutex::ScopedLock scoped_lock(thread_start_lock_); @@ -288,7 +288,8 @@ void InspectorIo::ThreadMain() { new InspectorIoDelegate(queue, main_thread_, id_, script_path, script_name_)); InspectorSocketServer server(std::move(delegate), &loop, - options_.host_name(), options_.port()); + options_->host().c_str(), + options_->port()); request_queue_ = queue->handle(); // Its lifetime is now that of the server delegate queue.reset(); |