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

@ -19,19 +19,19 @@ struct ElementDefinitionOptions {
// https://html.spec.whatwg.org/multipage/custom-elements.html#customelementregistry
class CustomElementRegistry : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(CustomElementRegistry, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(CustomElementRegistry);
GC_DECLARE_ALLOCATOR(CustomElementRegistry);
public:
virtual ~CustomElementRegistry() override;
JS::ThrowCompletionOr<void> define(String const& name, WebIDL::CallbackType* constructor, ElementDefinitionOptions options);
Variant<JS::Handle<WebIDL::CallbackType>, JS::Value> get(String const& name) const;
Optional<String> get_name(JS::Handle<WebIDL::CallbackType> const& constructor) const;
WebIDL::ExceptionOr<JS::NonnullGCPtr<WebIDL::Promise>> when_defined(String const& name);
void upgrade(JS::NonnullGCPtr<DOM::Node> root) const;
Variant<GC::Root<WebIDL::CallbackType>, JS::Value> get(String const& name) const;
Optional<String> get_name(GC::Root<WebIDL::CallbackType> const& constructor) const;
WebIDL::ExceptionOr<GC::Ref<WebIDL::Promise>> when_defined(String const& name);
void upgrade(GC::Ref<DOM::Node> root) const;
JS::GCPtr<CustomElementDefinition> get_definition_with_name_and_local_name(String const& name, String const& local_name) const;
JS::GCPtr<CustomElementDefinition> get_definition_from_new_target(JS::FunctionObject const& new_target) const;
GC::Ptr<CustomElementDefinition> get_definition_with_name_and_local_name(String const& name, String const& local_name) const;
GC::Ptr<CustomElementDefinition> get_definition_from_new_target(JS::FunctionObject const& new_target) const;
private:
CustomElementRegistry(JS::Realm&);
@ -40,7 +40,7 @@ private:
virtual void visit_edges(Visitor&) override;
// Every CustomElementRegistry has a set of custom element definitions, initially empty. In general, algorithms in this specification look up elements in the registry by any of name, local name, or constructor.
Vector<JS::NonnullGCPtr<CustomElementDefinition>> m_custom_element_definitions;
Vector<GC::Ref<CustomElementDefinition>> m_custom_element_definitions;
// https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition-is-running
// Every CustomElementRegistry also has an element definition is running flag which is used to prevent reentrant invocations of element definition. It is initially unset.
@ -48,7 +48,7 @@ private:
// https://html.spec.whatwg.org/multipage/custom-elements.html#when-defined-promise-map
// Every CustomElementRegistry also has a when-defined promise map, mapping valid custom element names to promises. It is used to implement the whenDefined() method.
OrderedHashMap<String, JS::NonnullGCPtr<WebIDL::Promise>> m_when_defined_promise_map;
OrderedHashMap<String, GC::Ref<WebIDL::Promise>> m_when_defined_promise_map;
};
}