LibWeb: Change agent's signal_slots into a GC::RootVector

As part of this, also move the constructor out of line so we don't
unnecessarily add transitive includes.
This commit is contained in:
Jelle Raaijmakers 2025-11-24 10:05:36 +01:00 committed by Sam Atkins
parent 4cca341315
commit c0939725a2
Notes: github-actions[bot] 2025-11-24 12:46:33 +00:00
2 changed files with 12 additions and 8 deletions

View file

@ -1,10 +1,13 @@
/*
* Copyright (c) 2025, Shannon Booth <shannon@serenityos.org>
* Copyright (c) 2025, Jelle Raaijmakers <jelle@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/HTML/HTMLSlotElement.h>
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/SimilarOriginWindowAgent.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
@ -27,4 +30,11 @@ SimilarOriginWindowAgent& relevant_similar_origin_window_agent(JS::Object const&
return as<SimilarOriginWindowAgent>(*relevant_realm(object).vm().agent());
}
SimilarOriginWindowAgent::SimilarOriginWindowAgent(GC::Heap& heap, CanBlock can_block)
: Agent(can_block)
, pending_mutation_observers(heap)
, signal_slots(heap)
{
}
}

View file

@ -12,9 +12,7 @@
#include <LibGC/Root.h>
#include <LibJS/Forward.h>
#include <LibJS/Runtime/Agent.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/Export.h>
#include <LibWeb/Forward.h>
#include <LibWeb/HTML/CustomElements/CustomElementReactionsStack.h>
#include <LibWeb/HTML/Scripting/Agent.h>
@ -38,7 +36,7 @@ struct SimilarOriginWindowAgent : public Agent {
// https://dom.spec.whatwg.org/#signal-slot-list
// Each similar-origin window agent has signal slots (a set of slots), which is initially empty. [HTML]
Vector<GC::Root<HTML::HTMLSlotElement>> signal_slots;
GC::RootVector<GC::Ref<HTMLSlotElement>> signal_slots;
// https://html.spec.whatwg.org/multipage/custom-elements.html#current-element-queue
// A similar-origin window agent's current element queue is the element queue at the top of its custom element reactions stack.
@ -46,11 +44,7 @@ struct SimilarOriginWindowAgent : public Agent {
Vector<GC::Root<DOM::Element>> const& current_element_queue() const { return custom_element_reactions_stack.element_queue_stack.last(); }
private:
SimilarOriginWindowAgent(GC::Heap& heap, CanBlock can_block)
: Agent(can_block)
, pending_mutation_observers(heap)
{
}
SimilarOriginWindowAgent(GC::Heap&, CanBlock);
};
WEB_API SimilarOriginWindowAgent& relevant_similar_origin_window_agent(JS::Object const&);