mirror of
https://github.com/nodejs/node.git
synced 2026-12-06 01:28:50 -05:00
Add an ExitCode enum class and use it throughout the code base instead of hard-coding the exit codes everywhere. At the moment, the exit codes used in many places do not actually conform to what the documentation describes. With the new enums (which are also available to the JS land as constants in an internal binding) we could migrate to a more consistent usage of the codes, and eventually expose the constants to the user land when they are stable enough. PR-URL: https://github.com/nodejs/node/pull/44746 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
46 lines
1.4 KiB
C++
46 lines
1.4 KiB
C++
|
|
#ifndef SRC_NODE_SNAPSHOT_BUILDER_H_
|
|
#define SRC_NODE_SNAPSHOT_BUILDER_H_
|
|
|
|
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
#include <cstdint>
|
|
#include "node_exit_code.h"
|
|
#include "node_mutex.h"
|
|
#include "v8.h"
|
|
|
|
namespace node {
|
|
|
|
class ExternalReferenceRegistry;
|
|
struct SnapshotData;
|
|
|
|
class NODE_EXTERN_PRIVATE SnapshotBuilder {
|
|
public:
|
|
static ExitCode Generate(std::ostream& out,
|
|
const std::vector<std::string> args,
|
|
const std::vector<std::string> exec_args);
|
|
|
|
// Generate the snapshot into out.
|
|
static ExitCode Generate(SnapshotData* out,
|
|
const std::vector<std::string> args,
|
|
const std::vector<std::string> exec_args);
|
|
|
|
// If nullptr is returned, the binary is not built with embedded
|
|
// snapshot.
|
|
static const SnapshotData* GetEmbeddedSnapshotData();
|
|
static void InitializeIsolateParams(const SnapshotData* data,
|
|
v8::Isolate::CreateParams* params);
|
|
|
|
private:
|
|
// Used to synchronize access to the snapshot data
|
|
static Mutex snapshot_data_mutex_;
|
|
static const std::vector<intptr_t>& CollectExternalReferences();
|
|
|
|
static std::unique_ptr<ExternalReferenceRegistry> registry_;
|
|
};
|
|
} // namespace node
|
|
|
|
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
|
|
|
#endif // SRC_NODE_SNAPSHOT_BUILDER_H_
|