mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 13:19:05 +00:00
LibWeb: Change Storage{Bottle,Bucket,Shelf} to be GC-allocated
In upcoming changes StorageBottle will own pointers to GC-allocated objects, so it needs to be a GC-allocated object itself to avoid introducing more GC roots.
This commit is contained in:
parent
70a29f36c6
commit
f53559cb55
Notes:
github-actions[bot]
2025-06-12 15:06:02 +00:00
Author: https://github.com/kalenikaliaksandr
Commit: f53559cb55
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5052
Reviewed-by: https://github.com/shannonbooth ✅
Reviewed-by: https://github.com/trflynn89
12 changed files with 117 additions and 44 deletions
|
@ -27,7 +27,7 @@ public:
|
|||
Session,
|
||||
};
|
||||
|
||||
[[nodiscard]] static GC::Ref<Storage> create(JS::Realm&, Type, NonnullRefPtr<StorageAPI::StorageBottle>);
|
||||
[[nodiscard]] static GC::Ref<Storage> create(JS::Realm&, Type, GC::Ref<StorageAPI::StorageBottle>);
|
||||
|
||||
~Storage();
|
||||
|
||||
|
@ -44,10 +44,11 @@ public:
|
|||
void dump() const;
|
||||
|
||||
private:
|
||||
Storage(JS::Realm&, Type, NonnullRefPtr<StorageAPI::StorageBottle>);
|
||||
Storage(JS::Realm&, Type, GC::Ref<StorageAPI::StorageBottle>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void finalize() override;
|
||||
virtual void visit_edges(GC::Cell::Visitor&) override;
|
||||
|
||||
// ^PlatformObject
|
||||
virtual Optional<JS::Value> item_value(size_t index) const override;
|
||||
|
@ -61,7 +62,7 @@ private:
|
|||
void broadcast(Optional<String> const& key, Optional<String> const& old_value, Optional<String> const& new_value);
|
||||
|
||||
Type m_type {};
|
||||
NonnullRefPtr<StorageAPI::StorageBottle> m_storage_bottle;
|
||||
GC::Ref<StorageAPI::StorageBottle> m_storage_bottle;
|
||||
u64 m_stored_bytes { 0 };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue