mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:58:12 +00:00
LibWeb: Make BrowsingContext GC-allocated
(And BrowsingContextGroup had to come along for the ride as well.) This solves a number of nasty reference cycles between browsing contexts, history items, and their documents.
This commit is contained in:
parent
2898701459
commit
83c5ff57d8
15 changed files with 225 additions and 44 deletions
|
@ -8,14 +8,16 @@
|
|||
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
class BrowsingContextGroup : public RefCounted<BrowsingContextGroup> {
|
||||
class BrowsingContextGroup final : public JS::Cell {
|
||||
JS_CELL(BrowsingContextGroup, JS::Cell);
|
||||
|
||||
public:
|
||||
static NonnullRefPtr<BrowsingContextGroup> create_a_new_browsing_context_group(Page&);
|
||||
static JS::NonnullGCPtr<BrowsingContextGroup> create_a_new_browsing_context_group(Page&);
|
||||
~BrowsingContextGroup();
|
||||
|
||||
Page* page() { return m_page; }
|
||||
|
@ -30,8 +32,10 @@ public:
|
|||
private:
|
||||
explicit BrowsingContextGroup(Web::Page&);
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-group-set
|
||||
OrderedHashTable<NonnullRefPtr<BrowsingContext>> m_browsing_context_set;
|
||||
OrderedHashTable<BrowsingContext*> m_browsing_context_set;
|
||||
|
||||
WeakPtr<Page> m_page;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue