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

@ -13,23 +13,23 @@
namespace Web::HTML {
// FIXME: Include ServiceWorker
using MessageEventSource = Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>>;
using MessageEventSource = Variant<GC::Root<WindowProxy>, GC::Root<MessagePort>>;
struct MessageEventInit : public DOM::EventInit {
JS::Value data { JS::js_null() };
String origin {};
String last_event_id {};
Optional<MessageEventSource> source;
Vector<JS::Handle<MessagePort>> ports;
Vector<GC::Root<MessagePort>> ports;
};
class MessageEvent : public DOM::Event {
WEB_PLATFORM_OBJECT(MessageEvent, DOM::Event);
JS_DECLARE_ALLOCATOR(MessageEvent);
GC_DECLARE_ALLOCATOR(MessageEvent);
public:
[[nodiscard]] static JS::NonnullGCPtr<MessageEvent> create(JS::Realm&, FlyString const& event_name, MessageEventInit const& = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<MessageEvent>> construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const&);
[[nodiscard]] static GC::Ref<MessageEvent> create(JS::Realm&, FlyString const& event_name, MessageEventInit const& = {});
static WebIDL::ExceptionOr<GC::Ref<MessageEvent>> construct_impl(JS::Realm&, FlyString const& event_name, MessageEventInit const&);
MessageEvent(JS::Realm&, FlyString const& event_name, MessageEventInit const& event_init);
virtual ~MessageEvent() override;
@ -37,10 +37,10 @@ public:
JS::Value data() const { return m_data; }
String const& origin() const { return m_origin; }
String const& last_event_id() const { return m_last_event_id; }
JS::NonnullGCPtr<JS::Object> ports() const;
Variant<JS::Handle<WindowProxy>, JS::Handle<MessagePort>, Empty> source() const;
GC::Ref<JS::Object> ports() const;
Variant<GC::Root<WindowProxy>, GC::Root<MessagePort>, Empty> source() const;
void init_message_event(String const& type, bool bubbles, bool cancelable, JS::Value data, String const& origin, String const& last_event_id, Optional<MessageEventSource> source, Vector<JS::Handle<MessagePort>> const& ports);
void init_message_event(String const& type, bool bubbles, bool cancelable, JS::Value data, String const& origin, String const& last_event_id, Optional<MessageEventSource> source, Vector<GC::Root<MessagePort>> const& ports);
private:
virtual void initialize(JS::Realm&) override;
@ -50,8 +50,8 @@ private:
String m_origin;
String m_last_event_id;
Optional<MessageEventSource> m_source;
Vector<JS::NonnullGCPtr<JS::Object>> m_ports;
mutable JS::GCPtr<JS::Array> m_ports_array;
Vector<GC::Ref<JS::Object>> m_ports;
mutable GC::Ptr<JS::Array> m_ports_array;
};
}