FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

src: make debug_options getters public by codebytere · Pull Request #30494 · nodejs/node · GitHub

/ node Public

src: make debug_options getters public - #30494

Closed
codebytere wants to merge 1 commit into
nodejs:masterfrom
codebytere:move-debug-options
Closed

src: make debug_options getters public#30494
codebytere wants to merge 1 commit into
nodejs:masterfrom
codebytere:move-debug-options

Conversation

codebytere commented Nov 15, 2019
edited
Loading

Copy link
Copy Markdown
Member

Refs #30466.

Now that Electron is parsing and passing CLI options, we can set DebugOptions ourselves through ParseGlobalArgs. However, we also need to create and start the inspector agent with the DebugOptions set by users, since the inspector agent Start function takes a parameter const DebugOptions& options.

The most straightforward way to do this is for us to pass env->options()->debug_options() to our inspector agent Start call, but since debug_options was defined in src/node_options-inl.h we'd need to require extra files to do what could trivially be consolidated into one. This PR therefore moves those definitions into a public-facing file, allowing us to pass correct options to the inspector without needing to parse all-new ones we'd previously parsed on startup.

cc @joyeecheung @addaleax

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

nodejs-github-bot added the c++ Issues and PRs that require attention from people who are familiar with C++. label Nov 15, 2019
codebytere added the embedding Issues and PRs related to embedding Node.js in another project. label Nov 15, 2019

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Member

This has me scratching my head a lot…

However, we also need to create and start the inspector agent with the DebugOptions set by users

I think this is the main issue here – we should get Electron away from having to do this manually, and provide an API for that, rather than exposing various internals. In #30467, inspector setup would be moved into LoadEnvironment() (i.e. part of a public API), so it would be awesome if you could take a look at that, both from a general API perspective and regarding how it affects Electron specifically.

The most straightforward way to do this is for us to pass env->options()->debug_options() to our inspector agent Start call, but since debug_options was defined in src/node_options-inl.h we couldn't do that. This PR therefore moves those definitions into a public-facing file, allowing us to pass correct options to the inspector without needing to parse all-new ones we'd previously parsed on startup.

I’m a bit confused by this – src/node_options.h and src/node_options-inl.h should both be available to Electron in the same way, and neither of them are public-facing (anything guarded by NODE_WANT_INTERNALS is private), so I’m surprised that this PR improves the situation for Electron? I feel like learning a bit more about why and how it does that might help me understand more about how Electron uses Node’s source tree.

joyeecheung mentioned this pull request Nov 19, 2019
4 tasks

Copy link
Copy Markdown
Member Author

@addaleax since debug_options was defined in src/node_options-inl.h we'd need to require an extra file to do what could trivially be consolidated into one. This just simplifies our requires, since we already require the other file.

Copy link
Copy Markdown
Member

@codebytere Going by that, it’s probably the simplest solution if you only include the -inl.h file?

But yeah, you can feel free to go ahead and land this – just maybe update the commit message so it doesn’t give the impression that something’s being made part of the public API?

Copy link
Copy Markdown
Member Author

Will do! thanks :)

codebytere added the author ready PRs that have at least one approval, no outstanding review comments, and a CI started. label Dec 13, 2019

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

Copy link
Copy Markdown
Collaborator

codebytere added a commit that referenced this pull request Dec 14, 2019
This simplifies requires for those using DebugOptions,
since debug_options was defined in src/node_options-inl.h  and thus
embedders would need to require an extra file to do what could
trivially be consolidated into one.

PR-URL: #30494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>

codebytere commented Dec 14, 2019
edited
Loading

Copy link
Copy Markdown
Member Author

Landed in ccdd6ef

codebytere closed this Dec 14, 2019
codebytere deleted the move-debug-options branch December 14, 2019 14:46
MylesBorins pushed a commit that referenced this pull request Dec 17, 2019
This simplifies requires for those using DebugOptions,
since debug_options was defined in src/node_options-inl.h  and thus
embedders would need to require an extra file to do what could
trivially be consolidated into one.

PR-URL: #30494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
MylesBorins mentioned this pull request Dec 17, 2019
targos pushed a commit that referenced this pull request Jan 14, 2020
This simplifies requires for those using DebugOptions,
since debug_options was defined in src/node_options-inl.h  and thus
embedders would need to require an extra file to do what could
trivially be consolidated into one.

PR-URL: #30494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
BethGriggs pushed a commit that referenced this pull request Feb 6, 2020
This simplifies requires for those using DebugOptions,
since debug_options was defined in src/node_options-inl.h  and thus
embedders would need to require an extra file to do what could
trivially be consolidated into one.

PR-URL: #30494
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
MylesBorins mentioned this pull request Feb 8, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no outstanding review comments, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. embedding Issues and PRs related to embedding Node.js in another project.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL