mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:47:45 +00:00
LibWeb: Move event listeners, handlers and callbacks to the GC heap
This patch moves the following things to being GC-allocated: - Bindings::CallbackType - HTML::EventHandler - DOM::IDLEventListener - DOM::DOMEventListener - DOM::NodeFilter Note that we only use PlatformObject for things that might be exposed to web content. Anything that is only used internally inherits directly from JS::Cell instead, making them a bit more lightweight.
This commit is contained in:
parent
967a3e5a45
commit
8cda70c892
57 changed files with 425 additions and 345 deletions
|
@ -577,9 +577,9 @@ Bindings::CallbackType* XMLHttpRequest::onreadystatechange()
|
|||
return event_handler_attribute(Web::XHR::EventNames::readystatechange);
|
||||
}
|
||||
|
||||
void XMLHttpRequest::set_onreadystatechange(Optional<Bindings::CallbackType> value)
|
||||
void XMLHttpRequest::set_onreadystatechange(Bindings::CallbackType* value)
|
||||
{
|
||||
set_event_handler_attribute(Web::XHR::EventNames::readystatechange, move(value));
|
||||
set_event_handler_attribute(Web::XHR::EventNames::readystatechange, value);
|
||||
}
|
||||
|
||||
// https://xhr.spec.whatwg.org/#the-getallresponseheaders()-method
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
String get_all_response_headers() const;
|
||||
|
||||
Bindings::CallbackType* onreadystatechange();
|
||||
void set_onreadystatechange(Optional<Bindings::CallbackType>);
|
||||
void set_onreadystatechange(Bindings::CallbackType*);
|
||||
|
||||
DOM::ExceptionOr<void> override_mime_type(String const& mime);
|
||||
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
namespace Web::XHR {
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
void XMLHttpRequestEventTarget::set_##attribute_name(Optional<Bindings::CallbackType> value) \
|
||||
{ \
|
||||
set_event_handler_attribute(event_name, move(value)); \
|
||||
} \
|
||||
Bindings::CallbackType* XMLHttpRequestEventTarget::attribute_name() \
|
||||
{ \
|
||||
return event_handler_attribute(event_name); \
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
void XMLHttpRequestEventTarget::set_##attribute_name(Bindings::CallbackType* value) \
|
||||
{ \
|
||||
set_event_handler_attribute(event_name, value); \
|
||||
} \
|
||||
Bindings::CallbackType* XMLHttpRequestEventTarget::attribute_name() \
|
||||
{ \
|
||||
return event_handler_attribute(event_name); \
|
||||
}
|
||||
ENUMERATE_XML_HTTP_REQUEST_EVENT_TARGET_EVENT_HANDLERS(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
|
|
|
@ -30,8 +30,8 @@ public:
|
|||
virtual ~XMLHttpRequestEventTarget() override {};
|
||||
|
||||
#undef __ENUMERATE
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
void set_##attribute_name(Optional<Bindings::CallbackType>); \
|
||||
#define __ENUMERATE(attribute_name, event_name) \
|
||||
void set_##attribute_name(Bindings::CallbackType*); \
|
||||
Bindings::CallbackType* attribute_name();
|
||||
ENUMERATE_XML_HTTP_REQUEST_EVENT_TARGET_EVENT_HANDLERS(__ENUMERATE)
|
||||
#undef __ENUMERATE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue