Skip to content

src: remove deprecated initialization APIs in node.h #58470

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions src/api/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -583,26 +583,6 @@ MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env) {
return env->platform();
}

MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
node::tracing::TracingController* tracing_controller) {
return CreatePlatform(
thread_pool_size,
static_cast<v8::TracingController*>(tracing_controller));
}

MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller) {
return MultiIsolatePlatform::Create(thread_pool_size,
tracing_controller)
.release();
}

void FreePlatform(MultiIsolatePlatform* platform) {
delete platform;
}

std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create(
int thread_pool_size,
v8::TracingController* tracing_controller,
Expand Down
10 changes: 1 addition & 9 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ static ExitCode InitializeNodeWithArgsInternal(
std::vector<std::string>* exec_argv,
std::vector<std::string>* errors,
ProcessInitializationFlags::Flags flags) {
// Make sure InitializeNodeWithArgs() is called only once.
// Make sure InitializeNodeWithArgsInternal() is called only once.
CHECK(!init_called.exchange(true));

// Initialize node_start_time to get relative uptime.
Expand Down Expand Up @@ -1021,14 +1021,6 @@ static ExitCode InitializeNodeWithArgsInternal(
return ExitCode::kNoFailure;
}

int InitializeNodeWithArgs(std::vector<std::string>* argv,
std::vector<std::string>* exec_argv,
std::vector<std::string>* errors,
ProcessInitializationFlags::Flags flags) {
return static_cast<int>(
InitializeNodeWithArgsInternal(argv, exec_argv, errors, flags));
}

static std::shared_ptr<InitializationResultImpl>
InitializeOncePerProcessInternal(const std::vector<std::string>& args,
ProcessInitializationFlags::Flags flags =
Expand Down
35 changes: 6 additions & 29 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,22 +329,6 @@ NODE_EXTERN int Start(int argc, char* argv[]);
NODE_EXTERN int Stop(Environment* env,
StopFlags::Flags flags = StopFlags::kNoFlags);

// Set up per-process state needed to run Node.js. This will consume arguments
// from argv, fill exec_argv, and possibly add errors resulting from parsing
// the arguments to `errors`. The return value is a suggested exit code for the
// program; If it is 0, then initializing Node.js succeeded.
// This runs a subset of the initialization performed by
// InitializeOncePerProcess(), which supersedes this function.
// The subset is roughly equivalent to the one given by
// `ProcessInitializationFlags::kLegacyInitializeNodeWithArgsBehavior`.
NODE_DEPRECATED("Use InitializeOncePerProcess() instead",
NODE_EXTERN int InitializeNodeWithArgs(
std::vector<std::string>* argv,
std::vector<std::string>* exec_argv,
std::vector<std::string>* errors,
ProcessInitializationFlags::Flags flags =
ProcessInitializationFlags::kNoFlags));

// Set up per-process state needed to run Node.js. This will consume arguments
// from args, and return information about the initialization success,
// including the arguments split into argv/exec_argv, a list of potential
Expand Down Expand Up @@ -848,19 +832,12 @@ NODE_EXTERN void GetNodeReport(Environment* env,
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);

NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
int thread_pool_size,
v8::TracingController* tracing_controller));
NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
NODE_EXTERN void FreePlatform(MultiIsolatePlatform* platform));

// Get/set the currently active tracing controller. Using CreatePlatform()
// will implicitly set this by default. This is global and should be initialized
// along with the v8::Platform instance that is being used. `controller`
// is allowed to be `nullptr`.
// This is used for tracing events from Node.js itself. V8 uses the tracing
// controller returned from the active `v8::Platform` instance.
// Get/set the currently active tracing controller. Using
// MultiIsolatePlatform::Create() will implicitly set this by default. This is
// global and should be initialized along with the v8::Platform instance that is
// being used. `controller` is allowed to be `nullptr`. This is used for tracing
// events from Node.js itself. V8 uses the tracing controller returned from the
// active `v8::Platform` instance.
NODE_EXTERN v8::TracingController* GetTracingController();
NODE_EXTERN void SetTracingController(v8::TracingController* controller);

Expand Down
16 changes: 9 additions & 7 deletions test/cctest/node_test_fixture.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ class NodeZeroIsolateTestFixture : public ::testing::Test {
if (!node_initialized) {
node_initialized = true;
uv_os_unsetenv("NODE_OPTIONS");
std::vector<std::string> argv { "cctest" };
std::vector<std::string> exec_argv;
std::vector<std::string> errors;

int exitcode = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors);
CHECK_EQ(exitcode, 0);
CHECK(errors.empty());
std::vector<std::string> argv{"cctest"};

std::shared_ptr<node::InitializationResult> result =
node::InitializeOncePerProcess(
argv,
node::ProcessInitializationFlags::
kLegacyInitializeNodeWithArgsBehavior);
CHECK_EQ(result->exit_code(), 0);
CHECK(result->errors().empty());
}
CHECK_EQ(0, uv_loop_init(&current_loop));
}
Expand Down
Loading