diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2021-05-26 19:42:00 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2021-06-10 09:17:49 +0300 |
commit | 30e8b5e2a2638d26939eb6cb00c1ffb77fdba6f7 (patch) | |
tree | e131e2ad4cc707355cbe4c40db7ff94d2a9a77c8 /src/node_snapshotable.h | |
parent | f461158febdffe8eaa6468b1b716f2dbe40fd056 (diff) |
tools: refactor snapshot builder
This patch:
- Moves the snapshot building code to src/ so that we can reuse it
later when generating custom snapshots from an entry point accepted
by the node binary.
- Create a SnapshotData struct that incorporates all the data useful
for a snapshot blob, including both the V8 data and the Node.js
data.
PR-URL: https://github.com/nodejs/node/pull/38902
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Diffstat (limited to 'src/node_snapshotable.h')
-rw-r--r-- | src/node_snapshotable.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/node_snapshotable.h b/src/node_snapshotable.h index c3b82c6edc7..38da68f6d28 100644 --- a/src/node_snapshotable.h +++ b/src/node_snapshotable.h @@ -11,6 +11,7 @@ namespace node { class Environment; struct EnvSerializeInfo; +struct SnapshotData; #define SERIALIZABLE_OBJECT_TYPES(V) \ V(fs_binding_data, fs::BindingData) \ @@ -119,6 +120,15 @@ void SerializeBindingData(Environment* env, EnvSerializeInfo* info); bool IsSnapshotableType(FastStringKey key); + +class SnapshotBuilder { + public: + static std::string Generate(const std::vector<std::string> args, + const std::vector<std::string> exec_args); + static void Generate(SnapshotData* out, + const std::vector<std::string> args, + const std::vector<std::string> exec_args); +}; } // namespace node #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |