1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 06:57:35 +00:00

LibWeb: Make History GC-allocated

This commit is contained in:
Andreas Kling 2022-09-02 13:50:24 +02:00
parent abfb73f2e7
commit 16fbb91aa1
7 changed files with 40 additions and 25 deletions

View file

@ -1,31 +1,23 @@
/*
* Copyright (c) 2021, Luke Wilde <lukew@serenityos.org>
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/RefCounted.h>
#include <AK/Weakable.h>
#include <LibJS/Heap/Handle.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/ExceptionOr.h>
#include <LibWeb/Forward.h>
namespace Web::HTML {
class History final
: public RefCounted<History>
, public Weakable<History>
, public Bindings::Wrappable {
public:
using WrapperType = Bindings::HistoryWrapper;
class History final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(History, Bindings::PlatformObject);
static NonnullRefPtr<History> create(DOM::Document& document)
{
return adopt_ref(*new History(document));
}
public:
static JS::NonnullGCPtr<History> create(HTML::Window&, DOM::Document&);
virtual ~History() override;
@ -33,7 +25,9 @@ public:
DOM::ExceptionOr<void> replace_state(JS::Value data, String const& unused, String const& url);
private:
explicit History(DOM::Document&);
explicit History(HTML::Window&, DOM::Document&);
virtual void visit_edges(Cell::Visitor&) override;
enum class IsPush {
No,
@ -41,7 +35,9 @@ private:
};
DOM::ExceptionOr<void> shared_history_push_replace_state(JS::Value data, String const& url, IsPush is_push);
DOM::Document& m_associated_document;
JS::NonnullGCPtr<DOM::Document> m_associated_document;
};
}
WRAPPER_HACK(History, Web::HTML)