1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibJS+LibWeb: Normalize calls to Base::visit_edges in GC objects

This commit is contained in:
Matthew Olsson 2023-03-20 13:37:11 -07:00 committed by Andreas Kling
parent 98ed74087f
commit 82eeee2008
17 changed files with 20 additions and 15 deletions

View file

@ -30,6 +30,7 @@ public:
void visit_edges(Cell::Visitor& visitor) override
{
Base::visit_edges(visitor);
visitor.visit(m_getter);
visitor.visit(m_setter);
}

View file

@ -16,7 +16,7 @@ Environment::Environment(Environment* outer_environment)
void Environment::visit_edges(Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_outer_environment);
}

View file

@ -345,6 +345,7 @@ JS_ENUMERATE_BUILTIN_NAMESPACE_OBJECTS
void Intrinsics::visit_edges(Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_realm);
visitor.visit(m_empty_object_shape);
visitor.visit(m_new_object_shape);

View file

@ -1341,7 +1341,7 @@ Optional<Completion> Object::enumerate_object_properties(Function<Optional<Compl
void Object::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_shape);
for (auto& value : m_storage)

View file

@ -51,7 +51,7 @@ PrimitiveString::~PrimitiveString()
void PrimitiveString::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
if (m_is_rope) {
visitor.visit(m_lhs);
visitor.visit(m_rhs);

View file

@ -47,7 +47,7 @@ bool PrivateName::operator==(PrivateName const& rhs) const
void PrivateEnvironment::visit_edges(Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_outer_environment);
}

View file

@ -25,6 +25,7 @@ PromiseCapability::PromiseCapability(GCPtr<Object> promise, GCPtr<FunctionObject
void PromiseCapability::visit_edges(Cell::Visitor& visitor)
{
Base::visit_edges(visitor);
visitor.visit(m_promise);
visitor.visit(m_resolve);
visitor.visit(m_reject);

View file

@ -24,7 +24,7 @@ PromiseReaction::PromiseReaction(Type type, GCPtr<PromiseCapability> capability,
void PromiseReaction::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_capability);
}

View file

@ -15,7 +15,7 @@ namespace JS {
void PromiseValueList::visit_edges(Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
for (auto& val : m_values)
visitor.visit(val);
}

View file

@ -114,7 +114,7 @@ Shape::Shape(Shape& previous_shape, Object* new_prototype)
void Shape::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_realm);
visitor.visit(m_prototype);
visitor.visit(m_previous);

View file

@ -15,7 +15,7 @@ DOMEventListener::~DOMEventListener() = default;
void DOMEventListener::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(callback.ptr());
visitor.visit(signal.ptr());
}

View file

@ -16,6 +16,8 @@ namespace Web::DOM {
// https://dom.spec.whatwg.org/#concept-event-listener
// NOTE: The spec calls this "event listener", and it's *importantly* not the same as "EventListener"
class DOMEventListener : public JS::Cell {
JS_CELL(DOMEventListener, JS::Cell);
public:
DOMEventListener();
~DOMEventListener();
@ -43,7 +45,6 @@ public:
private:
virtual void visit_edges(Cell::Visitor&) override;
virtual StringView class_name() const override { return "DOMEventListener"sv; }
};
}

View file

@ -21,7 +21,7 @@ EventHandler::EventHandler(WebIDL::CallbackType& c)
void EventHandler::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(listener);
if (auto* callback = value.get_pointer<JS::GCPtr<WebIDL::CallbackType>>())

View file

@ -14,6 +14,8 @@
namespace Web::HTML {
class EventHandler final : public JS::Cell {
JS_CELL(EventHandler, JS::Cell);
public:
explicit EventHandler(DeprecatedString);
explicit EventHandler(WebIDL::CallbackType&);
@ -29,7 +31,6 @@ public:
JS::GCPtr<DOM::DOMEventListener> listener;
private:
virtual StringView class_name() const override { return "EventHandler"sv; }
virtual void visit_edges(Cell::Visitor&) override;
};

View file

@ -22,7 +22,7 @@ WindowEnvironmentSettingsObject::~WindowEnvironmentSettingsObject() = default;
void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
{
EnvironmentSettingsObject::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(m_window.ptr());
}

View file

@ -17,10 +17,9 @@ CallbackType::CallbackType(JS::Object& callback, HTML::EnvironmentSettingsObject
{
}
StringView CallbackType::class_name() const { return "CallbackType"sv; }
void CallbackType::visit_edges(Cell::Visitor& visitor)
{
Cell::visit_edges(visitor);
Base::visit_edges(visitor);
visitor.visit(callback);
visitor.visit(callback_context);
}

View file

@ -19,6 +19,8 @@ enum class OperationReturnsPromise {
// https://webidl.spec.whatwg.org/#idl-callback-interface
class CallbackType final : public JS::Cell {
JS_CELL(CallbackType, JS::Cell);
public:
CallbackType(JS::Object& callback, HTML::EnvironmentSettingsObject& callback_context, OperationReturnsPromise = OperationReturnsPromise::No);
@ -31,7 +33,6 @@ public:
OperationReturnsPromise operation_returns_promise;
private:
virtual StringView class_name() const override;
virtual void visit_edges(Cell::Visitor&) override;
};