ladybird/Userland/Libraries/LibWeb/HTML/NavigationTransition.h
Andreas Kling bfd354492e LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00

50 lines
2.0 KiB
C++

/*
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/HTML/NavigationType.h>
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationtransition
class NavigationTransition : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(NavigationTransition, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(NavigationTransition);
public:
[[nodiscard]] static JS::NonnullGCPtr<NavigationTransition> create(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>);
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-navigationtype
Bindings::NavigationType navigation_type() const { return m_navigation_type; }
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-from
JS::NonnullGCPtr<NavigationHistoryEntry> from() const { return m_from_entry; }
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-finished
JS::GCPtr<JS::Promise> finished() const { return m_finished_promise; }
virtual ~NavigationTransition() override;
private:
NavigationTransition(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-navigationtype
Bindings::NavigationType m_navigation_type;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-from
JS::NonnullGCPtr<NavigationHistoryEntry> m_from_entry;
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-finished
JS::GCPtr<JS::Promise> m_finished_promise;
};
}