LibGC+Everywhere: Factor out a LibGC from LibJS

Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
This commit is contained in:
Shannon Booth 2024-11-15 04:01:23 +13:00 committed by Andreas Kling
parent ce23efc5f6
commit f87041bf3a
Notes: github-actions[bot] 2024-11-15 13:50:17 +00:00
1722 changed files with 9939 additions and 9906 deletions

View file

@ -15,9 +15,9 @@
namespace Web::DOM {
JS_DEFINE_ALLOCATOR(HTMLCollection);
GC_DEFINE_ALLOCATOR(HTMLCollection);
JS::NonnullGCPtr<HTMLCollection> HTMLCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter)
GC::Ref<HTMLCollection> HTMLCollection::create(ParentNode& root, Scope scope, Function<bool(Element const&)> filter)
{
return root.realm().create<HTMLCollection>(root, scope, move(filter));
}
@ -57,7 +57,7 @@ void HTMLCollection::update_name_to_element_mappings_if_needed() const
update_cache_if_needed();
if (m_cached_name_to_element_mappings)
return;
m_cached_name_to_element_mappings = make<OrderedHashMap<FlyString, JS::NonnullGCPtr<Element>>>();
m_cached_name_to_element_mappings = make<OrderedHashMap<FlyString, GC::Ref<Element>>>();
for (auto const& element : m_cached_elements) {
// 1. If element has an ID which is not in result, append elements ID to result.
if (auto const& id = element->id(); id.has_value()) {
@ -98,10 +98,10 @@ void HTMLCollection::update_cache_if_needed() const
m_cached_dom_tree_version = root()->document().dom_tree_version();
}
JS::MarkedVector<JS::NonnullGCPtr<Element>> HTMLCollection::collect_matching_elements() const
GC::MarkedVector<GC::Ref<Element>> HTMLCollection::collect_matching_elements() const
{
update_cache_if_needed();
JS::MarkedVector<JS::NonnullGCPtr<Element>> elements(heap());
GC::MarkedVector<GC::Ref<Element>> elements(heap());
for (auto& element : m_cached_elements)
elements.append(element);
return elements;