diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-04-06 00:13:31 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-04-08 01:04:55 +0300 |
commit | 8aa7ef7840ef5f7161f3195e51a3fa6783290160 (patch) | |
tree | 5c1f78c86aff43e0b46c1789f05074a6dbfdd587 /src/node.h | |
parent | 6faa162f5561a005c2ea45f594bf7cfcbe10e1b6 (diff) |
src: initialize inspector before RunBootstrapping()
This is necessary for `--inspect-brk-node` to work, and for the
inspector to be aware of scripts created before bootstrapping.
Fixes: https://github.com/nodejs/node/issues/32648
Refs: https://github.com/nodejs/node/pull/30467#discussion_r396879908
PR-URL: https://github.com/nodejs/node/pull/32672
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/node.h b/src/node.h index 4278eedfcbe..16d30e89d2a 100644 --- a/src/node.h +++ b/src/node.h @@ -420,6 +420,10 @@ enum Flags : uint64_t { }; } // namespace EnvironmentFlags +struct InspectorParentHandle { + virtual ~InspectorParentHandle(); +}; + // TODO(addaleax): Maybe move per-Environment options parsing here. // Returns nullptr when the Environment cannot be created e.g. there are // pending JavaScript exceptions. @@ -436,16 +440,14 @@ NODE_EXTERN Environment* CreateEnvironment( const std::vector<std::string>& args, const std::vector<std::string>& exec_args, EnvironmentFlags::Flags flags = EnvironmentFlags::kDefaultFlags, - ThreadId thread_id = {} /* allocates a thread id automatically */); + ThreadId thread_id = {} /* allocates a thread id automatically */, + std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {}); -struct InspectorParentHandle { - virtual ~InspectorParentHandle(); -}; // Returns a handle that can be passed to `LoadEnvironment()`, making the // child Environment accessible to the inspector as if it were a Node.js Worker. // `child_thread_id` can be created using `AllocateEnvironmentThreadId()` // and then later passed on to `CreateEnvironment()` to create the child -// Environment. +// Environment, together with the inspector handle. // This method should not be called while the parent Environment is active // on another thread. NODE_EXTERN std::unique_ptr<InspectorParentHandle> GetInspectorParentHandle( @@ -463,14 +465,16 @@ using StartExecutionCallback = // TODO(addaleax): Deprecate this in favour of the MaybeLocal<> overload. NODE_EXTERN void LoadEnvironment(Environment* env); +// The `InspectorParentHandle` arguments here are ignored and not used. +// For passing `InspectorParentHandle`, use `CreateEnvironment()`. NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment( Environment* env, StartExecutionCallback cb, - std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {}); + std::unique_ptr<InspectorParentHandle> ignored_donotuse_removeme = {}); NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment( Environment* env, const char* main_script_source_utf8, - std::unique_ptr<InspectorParentHandle> inspector_parent_handle = {}); + std::unique_ptr<InspectorParentHandle> ignored_donotuse_removeme = {}); NODE_EXTERN void FreeEnvironment(Environment* env); // Set a callback that is called when process.exit() is called from JS, |