GeezerVison is showing github.com — src: make BaseObject::is_snapshotable virtual · nodejs/node@33436e3
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/base_object.h +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -158,8 +158,7 @@ class BaseObject : public MemoryRetainer { |
158 | 158 |
|
159 | 159 | virtual inline void OnGCCollect(); |
160 | 160 |
|
161 | | - bool is_snapshotable() const { return is_snapshotable_; } |
162 | | - void set_is_snapshotable(bool val) { is_snapshotable_ = val; } |
| 161 | + virtual inline bool is_snapshotable() const { return false; } |
163 | 162 |
|
164 | 163 | private: |
165 | 164 | v8::Local<v8::Object> WrappedObject() const override; |
@@ -209,7 +208,6 @@ class BaseObject : public MemoryRetainer { |
209 | 208 |
|
210 | 209 | Environment* env_; |
211 | 210 | PointerData* pointer_data_ = nullptr; |
212 | | - bool is_snapshotable_ = false; |
213 | 211 | }; |
214 | 212 |
|
215 | 213 | // Global alias for FromJSObject() to avoid churn. |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_snapshotable.cc -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,7 +16,6 @@ SnapshotableObject::SnapshotableObject(Environment* env, |
16 | 16 | Local<Object> wrap, |
17 | 17 | EmbedderObjectType type) |
18 | 18 | : BaseObject(env, wrap), type_(type) { |
19 | | - set_is_snapshotable(true); |
20 | 19 | } |
21 | 20 |
|
22 | 21 | const char* SnapshotableObject::GetTypeNameChars() const { |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_snapshotable.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,6 +90,7 @@ class SnapshotableObject : public BaseObject { |
90 | 90 | virtual void PrepareForSerialization(v8::Local<v8::Context> context, |
91 | 91 | v8::SnapshotCreator* creator) = 0; |
92 | 92 | virtual InternalFieldInfo* Serialize(int index) = 0; |
| 93 | + bool is_snapshotable() const override { return true; } |
93 | 94 | // We'll make sure that the type is set in the constructor |
94 | 95 | EmbedderObjectType type() { return type_; } |
95 | 96 |
|
|