ladybird/Libraries/LibWeb/HTML/TextTrackObserver.h
Shannon Booth 4d64f21fa5 LibWeb: Give IDL exposed PlatformObjects an InterfaceName
By making use of the WEB_PLATFORM_OBJECT macro we can remove
the boilerplate of needing to add this override for every
serializable platform object so that we can check whether they
are exposed or not.
2026-02-14 20:22:40 +01:00

37 lines
1.1 KiB
C++

/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGC/Function.h>
#include <LibJS/Forward.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Bindings/TextTrackPrototype.h>
#include <LibWeb/HTML/TextTrack.h>
namespace Web::HTML {
class TextTrackObserver final : public Bindings::PlatformObject {
WEB_NON_IDL_PLATFORM_OBJECT(TextTrackObserver, Bindings::PlatformObject);
GC_DECLARE_ALLOCATOR(TextTrackObserver);
public:
static constexpr bool OVERRIDES_FINALIZE = true;
[[nodiscard]] GC::Ptr<GC::Function<void(TextTrack::ReadinessState)>> track_readiness_observer() const { return m_track_readiness_observer; }
void set_track_readiness_observer(Function<void(TextTrack::ReadinessState)>);
private:
explicit TextTrackObserver(JS::Realm&, TextTrack&);
virtual void visit_edges(Cell::Visitor&) override;
virtual void finalize() override;
GC::Ref<TextTrack> m_text_track;
GC::Ptr<GC::Function<void(TextTrack::ReadinessState)>> m_track_readiness_observer;
};
}