• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 #ifndef SRC_NODE_SNAPSHOT_BUILDER_H_
3 #define SRC_NODE_SNAPSHOT_BUILDER_H_
4 
5 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
6 
7 #include <cstdint>
8 #include "node_mutex.h"
9 #include "v8.h"
10 
11 namespace node {
12 
13 class ExternalReferenceRegistry;
14 struct SnapshotData;
15 
16 class NODE_EXTERN_PRIVATE SnapshotBuilder {
17  public:
18   static int Generate(std::ostream& out,
19                       const std::vector<std::string> args,
20                       const std::vector<std::string> exec_args);
21 
22   // Generate the snapshot into out.
23   static int Generate(SnapshotData* out,
24                       const std::vector<std::string> args,
25                       const std::vector<std::string> exec_args);
26 
27   // If nullptr is returned, the binary is not built with embedded
28   // snapshot.
29   static const SnapshotData* GetEmbeddedSnapshotData();
30   static void InitializeIsolateParams(const SnapshotData* data,
31                                       v8::Isolate::CreateParams* params);
32 
33  private:
34   static const std::vector<intptr_t>& CollectExternalReferences();
35 
36   static std::unique_ptr<ExternalReferenceRegistry> registry_;
37 };
38 }  // namespace node
39 
40 #endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
41 
42 #endif  // SRC_NODE_SNAPSHOT_BUILDER_H_
43