1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:38:13 +00:00

LibWeb: Make PerformanceTiming GC-allocated

This commit is contained in:
Andreas Kling 2022-08-31 19:12:11 +02:00
parent 8c90e08e0b
commit 5f4d4ffe39
6 changed files with 31 additions and 15 deletions

View file

@ -9,10 +9,18 @@
namespace Web::NavigationTiming {
PerformanceTiming::PerformanceTiming(HTML::Window& window)
: m_window(JS::make_handle(window))
: PlatformObject(window.realm())
, m_window(window)
{
set_prototype(&window.cached_web_prototype("PerformanceTiming"));
}
PerformanceTiming::~PerformanceTiming() = default;
void PerformanceTiming::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_window.ptr());
}
}

View file

@ -6,21 +6,18 @@
#pragma once
#include <AK/RefCountForwarder.h>
#include <AK/StdLibExtras.h>
#include <LibWeb/Bindings/Wrappable.h>
#include <LibWeb/HTML/Window.h>
namespace Web::NavigationTiming {
class PerformanceTiming final
: public RefCounted<PerformanceTiming>
, public Bindings::Wrappable {
class PerformanceTiming final : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(PerformanceTiming, Bindings::PlatformObject);
public:
using WrapperType = Bindings::PerformanceTimingWrapper;
using AllowOwnPtr = TrueType;
explicit PerformanceTiming(HTML::Window&);
~PerformanceTiming();
u64 navigation_start() { return 0; }
@ -46,7 +43,13 @@ public:
u64 load_event_end() { return 0; }
private:
JS::Handle<HTML::Window> m_window;
explicit PerformanceTiming(HTML::Window&);
virtual void visit_edges(Cell::Visitor&) override;
JS::GCPtr<HTML::Window> m_window;
};
}
WRAPPER_HACK(PerformanceTiming, Web::NavigationTiming)