11cb0ef41Sopenharmony_ci 21cb0ef41Sopenharmony_ci#ifndef SRC_NODE_SNAPSHOT_BUILDER_H_ 31cb0ef41Sopenharmony_ci#define SRC_NODE_SNAPSHOT_BUILDER_H_ 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ci#include <cstdint> 81cb0ef41Sopenharmony_ci#include "node_mutex.h" 91cb0ef41Sopenharmony_ci#include "v8.h" 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cinamespace node { 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ciclass ExternalReferenceRegistry; 141cb0ef41Sopenharmony_cistruct SnapshotData; 151cb0ef41Sopenharmony_ci 161cb0ef41Sopenharmony_ciclass NODE_EXTERN_PRIVATE SnapshotBuilder { 171cb0ef41Sopenharmony_ci public: 181cb0ef41Sopenharmony_ci static int Generate(std::ostream& out, 191cb0ef41Sopenharmony_ci const std::vector<std::string> args, 201cb0ef41Sopenharmony_ci const std::vector<std::string> exec_args); 211cb0ef41Sopenharmony_ci 221cb0ef41Sopenharmony_ci // Generate the snapshot into out. 231cb0ef41Sopenharmony_ci static int Generate(SnapshotData* out, 241cb0ef41Sopenharmony_ci const std::vector<std::string> args, 251cb0ef41Sopenharmony_ci const std::vector<std::string> exec_args); 261cb0ef41Sopenharmony_ci 271cb0ef41Sopenharmony_ci // If nullptr is returned, the binary is not built with embedded 281cb0ef41Sopenharmony_ci // snapshot. 291cb0ef41Sopenharmony_ci static const SnapshotData* GetEmbeddedSnapshotData(); 301cb0ef41Sopenharmony_ci static void InitializeIsolateParams(const SnapshotData* data, 311cb0ef41Sopenharmony_ci v8::Isolate::CreateParams* params); 321cb0ef41Sopenharmony_ci 331cb0ef41Sopenharmony_ci private: 341cb0ef41Sopenharmony_ci static const std::vector<intptr_t>& CollectExternalReferences(); 351cb0ef41Sopenharmony_ci 361cb0ef41Sopenharmony_ci static std::unique_ptr<ExternalReferenceRegistry> registry_; 371cb0ef41Sopenharmony_ci}; 381cb0ef41Sopenharmony_ci} // namespace node 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_ci#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 411cb0ef41Sopenharmony_ci 421cb0ef41Sopenharmony_ci#endif // SRC_NODE_SNAPSHOT_BUILDER_H_ 43