mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibWeb: Do not return a GC::Root from HTMLTrackElement's track getter
There's no need to create a root each time the getter is called. We should also allocate it in the `initialize` overload rather than the constructor.
This commit is contained in:
parent
642dd751cf
commit
c6a94fe513
Notes:
github-actions[bot]
2025-06-12 16:27:10 +00:00
Author: https://github.com/trflynn89
Commit: c6a94fe513
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5068
Reviewed-by: https://github.com/tcl3
2 changed files with 3 additions and 2 deletions
|
@ -27,7 +27,6 @@ GC_DEFINE_ALLOCATOR(HTMLTrackElement);
|
||||||
HTMLTrackElement::HTMLTrackElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
HTMLTrackElement::HTMLTrackElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||||
: HTMLElement(document, move(qualified_name))
|
: HTMLElement(document, move(qualified_name))
|
||||||
{
|
{
|
||||||
m_track = TextTrack::create(document.realm());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
HTMLTrackElement::~HTMLTrackElement() = default;
|
HTMLTrackElement::~HTMLTrackElement() = default;
|
||||||
|
@ -36,6 +35,8 @@ void HTMLTrackElement::initialize(JS::Realm& realm)
|
||||||
{
|
{
|
||||||
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTrackElement);
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLTrackElement);
|
||||||
Base::initialize(realm);
|
Base::initialize(realm);
|
||||||
|
|
||||||
|
m_track = TextTrack::create(realm);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLTrackElement::visit_edges(Cell::Visitor& visitor)
|
void HTMLTrackElement::visit_edges(Cell::Visitor& visitor)
|
||||||
|
|
|
@ -21,7 +21,7 @@ public:
|
||||||
|
|
||||||
WebIDL::UnsignedShort ready_state();
|
WebIDL::UnsignedShort ready_state();
|
||||||
|
|
||||||
GC::Root<TextTrack> track() { return m_track; }
|
GC::Ref<TextTrack> track() { return *m_track; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTrackElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTrackElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue