Skip to content

Commit 30c2b0f

Browse files
addaleaxBethGriggs
authored andcommitted
src: deprecate embedder APIs with replacements
Implement a number of TODO comments aiming at the eventual removal of some embedder APIs that now have replacements available. PR-URL: #32858 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
1 parent 98b30b0 commit 30c2b0f

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/node.h

+20-20
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,14 @@ NODE_EXTERN int Start(int argc, char* argv[]);
227227
// in the loop and / or actively executing JavaScript code).
228228
NODE_EXTERN int Stop(Environment* env);
229229

230-
// TODO(addaleax): Officially deprecate this and replace it with something
231-
// better suited for a public embedder API.
232230
// It is recommended to use InitializeNodeWithArgs() instead as an embedder.
233231
// Init() calls InitializeNodeWithArgs() and exits the process with the exit
234232
// code returned from it.
235-
NODE_EXTERN void Init(int* argc,
236-
const char** argv,
237-
int* exec_argc,
238-
const char*** exec_argv);
233+
NODE_DEPRECATED("Use InitializeNodeWithArgs() instead",
234+
NODE_EXTERN void Init(int* argc,
235+
const char** argv,
236+
int* exec_argc,
237+
const char*** exec_argv));
239238
// Set up per-process state needed to run Node.js. This will consume arguments
240239
// from argv, fill exec_argv, and possibly add errors resulting from parsing
241240
// the arguments to `errors`. The return value is a suggested exit code for the
@@ -428,12 +427,13 @@ struct InspectorParentHandle {
428427
// Returns nullptr when the Environment cannot be created e.g. there are
429428
// pending JavaScript exceptions.
430429
// It is recommended to use the second variant taking a flags argument.
431-
NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
432-
v8::Local<v8::Context> context,
433-
int argc,
434-
const char* const* argv,
435-
int exec_argc,
436-
const char* const* exec_argv);
430+
NODE_DEPRECATED("Use overload taking a flags argument",
431+
NODE_EXTERN Environment* CreateEnvironment(IsolateData* isolate_data,
432+
v8::Local<v8::Context> context,
433+
int argc,
434+
const char* const* argv,
435+
int exec_argc,
436+
const char* const* exec_argv));
437437
NODE_EXTERN Environment* CreateEnvironment(
438438
IsolateData* isolate_data,
439439
v8::Local<v8::Context> context,
@@ -463,8 +463,8 @@ struct StartExecutionCallbackInfo {
463463
using StartExecutionCallback =
464464
std::function<v8::MaybeLocal<v8::Value>(const StartExecutionCallbackInfo&)>;
465465

466-
// TODO(addaleax): Deprecate this in favour of the MaybeLocal<> overload.
467-
NODE_EXTERN void LoadEnvironment(Environment* env);
466+
NODE_DEPRECATED("Use variants returning MaybeLocal<> instead",
467+
NODE_EXTERN void LoadEnvironment(Environment* env));
468468
// The `InspectorParentHandle` arguments here are ignored and not used.
469469
// For passing `InspectorParentHandle`, use `CreateEnvironment()`.
470470
NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(
@@ -495,18 +495,18 @@ NODE_EXTERN Environment* GetCurrentEnvironment(v8::Local<v8::Context> context);
495495
// This returns the MultiIsolatePlatform used in the main thread of Node.js.
496496
// If NODE_USE_V8_PLATFORM has not been defined when Node.js was built,
497497
// it returns nullptr.
498-
// TODO(addaleax): Deprecate in favour of GetMultiIsolatePlatform().
499-
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform();
498+
NODE_DEPRECATED("Use GetMultiIsolatePlatform(env) instead",
499+
NODE_EXTERN MultiIsolatePlatform* GetMainThreadMultiIsolatePlatform());
500500
// This returns the MultiIsolatePlatform used for an Environment or IsolateData
501501
// instance, if one exists.
502502
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
503503
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
504504

505505
// Legacy variants of MultiIsolatePlatform::Create().
506-
// TODO(addaleax): Deprecate in favour of the v8::TracingController variant.
507-
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
508-
int thread_pool_size,
509-
node::tracing::TracingController* tracing_controller);
506+
NODE_DEPRECATED("Use variant taking a v8::TracingController* pointer instead",
507+
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
508+
int thread_pool_size,
509+
node::tracing::TracingController* tracing_controller));
510510
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
511511
int thread_pool_size,
512512
v8::TracingController* tracing_controller);

0 commit comments

Comments
 (0)