summaryrefslogtreecommitdiff
path: root/src/env.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-04-18 16:25:32 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2019-04-23 11:25:59 +0800
commitffcc949f1cb72c19e4c7db6704ae02d0f7dac232 (patch)
tree42d51f4026457404bf815b79f97792528dedb852 /src/env.h
parent70d887e95717a6b89135bf5cfd7b6394f451abe7 (diff)
downloadandroid-node-v8-ffcc949f1cb72c19e4c7db6704ae02d0f7dac232.tar.gz
android-node-v8-ffcc949f1cb72c19e4c7db6704ae02d0f7dac232.tar.bz2
android-node-v8-ffcc949f1cb72c19e4c7db6704ae02d0f7dac232.zip
src: implement IsolateData serialization and deserialization
This patch allows serializing per-isolate data into an isolate snapshot and deserializing them from an isolate snapthot. PR-URL: https://github.com/nodejs/node/pull/27321 Refs: https://github.com/nodejs/node/issues/17058 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/env.h')
-rw-r--r--src/env.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/env.h b/src/env.h
index def7cba388..24050cc9f4 100644
--- a/src/env.h
+++ b/src/env.h
@@ -33,6 +33,7 @@
#include "node.h"
#include "node_binding.h"
#include "node_http2_state.h"
+#include "node_main_instance.h"
#include "node_options.h"
#include "req_wrap.h"
#include "util.h"
@@ -418,10 +419,12 @@ class IsolateData : public MemoryRetainer {
IsolateData(v8::Isolate* isolate,
uv_loop_t* event_loop,
MultiIsolatePlatform* platform = nullptr,
- ArrayBufferAllocator* node_allocator = nullptr);
+ ArrayBufferAllocator* node_allocator = nullptr,
+ const NodeMainInstance::IndexArray* indexes = nullptr);
SET_MEMORY_INFO_NAME(IsolateData);
SET_SELF_SIZE(IsolateData);
void MemoryInfo(MemoryTracker* tracker) const override;
+ std::vector<size_t> Serialize(v8::SnapshotCreator* creator);
inline uv_loop_t* event_loop() const;
inline MultiIsolatePlatform* platform() const;
@@ -451,6 +454,9 @@ class IsolateData : public MemoryRetainer {
IsolateData& operator=(const IsolateData&) = delete;
private:
+ void DeserializeProperties(const NodeMainInstance::IndexArray* indexes);
+ void CreateProperties();
+
#define VP(PropertyName, StringValue) V(v8::Private, PropertyName)
#define VY(PropertyName, StringValue) V(v8::Symbol, PropertyName)
#define VS(PropertyName, StringValue) V(v8::String, PropertyName)