Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: make BaseObject::is_snapshotable virtual #37539

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/base_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ class BaseObject : public MemoryRetainer {

virtual inline void OnGCCollect();

bool is_snapshotable() const { return is_snapshotable_; }
void set_is_snapshotable(bool val) { is_snapshotable_ = val; }
virtual inline bool is_snapshotable() const { return false; }
Flarna marked this conversation as resolved.
Show resolved Hide resolved

private:
v8::Local<v8::Object> WrappedObject() const override;
Expand Down Expand Up @@ -209,7 +208,6 @@ class BaseObject : public MemoryRetainer {

Environment* env_;
PointerData* pointer_data_ = nullptr;
bool is_snapshotable_ = false;
};

// Global alias for FromJSObject() to avoid churn.
Expand Down
1 change: 0 additions & 1 deletion src/node_snapshotable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ SnapshotableObject::SnapshotableObject(Environment* env,
Local<Object> wrap,
EmbedderObjectType type)
: BaseObject(env, wrap), type_(type) {
set_is_snapshotable(true);
}

const char* SnapshotableObject::GetTypeNameChars() const {
Expand Down
1 change: 1 addition & 0 deletions src/node_snapshotable.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ class SnapshotableObject : public BaseObject {
virtual void PrepareForSerialization(v8::Local<v8::Context> context,
v8::SnapshotCreator* creator) = 0;
virtual InternalFieldInfo* Serialize(int index) = 0;
bool is_snapshotable() const override { return true; }
// We'll make sure that the type is set in the constructor
EmbedderObjectType type() { return type_; }

Expand Down