diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2021-02-08 15:34:02 +0300 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2021-02-19 14:08:04 +0300 |
commit | 3c8290c5a8afd851f2521a507b375ca5c91ce87b (patch) | |
tree | 1e45d4a641f7783269d8afda8cc941be1dc2dc49 /src/base_object.h | |
parent | 05286b9dd4d9d38d514c56c030bd330588eb40b0 (diff) |
src: support serialization of binding data
This patch adds the SnapshotableObject interface. Native objects
supporting serialization can inherit from it, implementing
PrepareForSerialization(), Serialize() and Deserialize()
to control how the native states should be serialized and
deserialized.
See doc: https://docs.google.com/document/d/15bu038I36oILq5t4Qju1sS2nKudVB6NSGWz00oD48Q8/edit
PR-URL: https://github.com/nodejs/node/pull/36943
Fixes: https://github.com/nodejs/node/issues/35930
Refs: https://github.com/nodejs/node/issues/35711
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/base_object.h')
-rw-r--r-- | src/base_object.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/base_object.h b/src/base_object.h index 3eac795e783..6482bd85f86 100644 --- a/src/base_object.h +++ b/src/base_object.h @@ -158,6 +158,9 @@ class BaseObject : public MemoryRetainer { virtual inline void OnGCCollect(); + bool is_snapshotable() const { return is_snapshotable_; } + void set_is_snapshotable(bool val) { is_snapshotable_ = val; } + private: v8::Local<v8::Object> WrappedObject() const override; bool IsRootNode() const override; @@ -206,6 +209,7 @@ class BaseObject : public MemoryRetainer { Environment* env_; PointerData* pointer_data_ = nullptr; + bool is_snapshotable_ = false; }; // Global alias for FromJSObject() to avoid churn. |