mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:57:44 +00:00
LibWeb/LibJS: Avoid GC visit of raw pointers where possible
This is mostly motivated for aesthetics, but also helps avoid some null checks when we have a NonnullGCPtr<T> or in some cases a T&.
This commit is contained in:
parent
4e04f81626
commit
6a2a7cad61
54 changed files with 100 additions and 100 deletions
|
@ -49,7 +49,7 @@ void CanvasRenderingContext2D::initialize(JS::Realm& realm)
|
|||
void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_element.ptr());
|
||||
visitor.visit(m_element);
|
||||
}
|
||||
|
||||
HTMLCanvasElement& CanvasRenderingContext2D::canvas_element()
|
||||
|
|
|
@ -35,7 +35,7 @@ void DOMStringMap::initialize(JS::Realm& realm)
|
|||
void DOMStringMap::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_associated_element.ptr());
|
||||
visitor.visit(m_associated_element);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#concept-domstringmap-pairs
|
||||
|
|
|
@ -46,10 +46,10 @@ void HTMLCanvasElement::visit_edges(Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
m_context.visit(
|
||||
[&](JS::NonnullGCPtr<CanvasRenderingContext2D>& context) {
|
||||
visitor.visit(context.ptr());
|
||||
visitor.visit(context);
|
||||
},
|
||||
[&](JS::NonnullGCPtr<WebGL::WebGLRenderingContext>& context) {
|
||||
visitor.visit(context.ptr());
|
||||
visitor.visit(context);
|
||||
},
|
||||
[](Empty) {
|
||||
});
|
||||
|
|
|
@ -54,7 +54,7 @@ void HTMLElement::initialize(JS::Realm& realm)
|
|||
void HTMLElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_dataset.ptr());
|
||||
visitor.visit(m_dataset);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/dom.html#dom-dir
|
||||
|
|
|
@ -49,7 +49,7 @@ void HTMLFormElement::visit_edges(Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_elements);
|
||||
for (auto& element : m_associated_elements)
|
||||
visitor.visit(element.ptr());
|
||||
visitor.visit(element);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-form-submit
|
||||
|
|
|
@ -62,7 +62,7 @@ void HTMLInputElement::visit_edges(Cell::Visitor& visitor)
|
|||
visitor.visit(m_placeholder_element);
|
||||
visitor.visit(m_placeholder_text_node);
|
||||
visitor.visit(m_color_well_element);
|
||||
visitor.visit(m_legacy_pre_activation_behavior_checked_element_in_group.ptr());
|
||||
visitor.visit(m_legacy_pre_activation_behavior_checked_element_in_group);
|
||||
visitor.visit(m_selected_files);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@ void HTMLScriptElement::visit_edges(Cell::Visitor& visitor)
|
|||
{
|
||||
Base::visit_edges(visitor);
|
||||
if (auto* script = m_result.get_pointer<JS::NonnullGCPtr<Script>>())
|
||||
visitor.visit(script->ptr());
|
||||
visitor.visit(m_parser_document.ptr());
|
||||
visitor.visit(m_preparation_time_document.ptr());
|
||||
visitor.visit(*script);
|
||||
visitor.visit(m_parser_document);
|
||||
visitor.visit(m_preparation_time_document);
|
||||
}
|
||||
|
||||
void HTMLScriptElement::attribute_changed(FlyString const& name, Optional<DeprecatedString> const& value)
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLSelectElement::initialize(JS::Realm& realm)
|
|||
void HTMLSelectElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_options.ptr());
|
||||
visitor.visit(m_options);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/form-elements.html#dom-select-options
|
||||
|
|
|
@ -29,7 +29,7 @@ void HTMLTemplateElement::initialize(JS::Realm& realm)
|
|||
void HTMLTemplateElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_content.ptr());
|
||||
visitor.visit(m_content);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/scripting.html#the-template-element:concept-node-adopt-ext
|
||||
|
|
|
@ -35,7 +35,7 @@ void History::initialize(JS::Realm& realm)
|
|||
void History::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_associated_document.ptr());
|
||||
visitor.visit(m_associated_document);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/history.html#dom-history-pushstate
|
||||
|
|
|
@ -49,7 +49,7 @@ void ImageData::initialize(JS::Realm& realm)
|
|||
void ImageData::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_data.ptr());
|
||||
visitor.visit(m_data);
|
||||
}
|
||||
|
||||
unsigned ImageData::width() const
|
||||
|
|
|
@ -34,8 +34,8 @@ MessageChannel::~MessageChannel() = default;
|
|||
void MessageChannel::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_port1.ptr());
|
||||
visitor.visit(m_port2.ptr());
|
||||
visitor.visit(m_port1);
|
||||
visitor.visit(m_port2);
|
||||
}
|
||||
|
||||
void MessageChannel::initialize(JS::Realm& realm)
|
||||
|
|
|
@ -35,7 +35,7 @@ void MessagePort::initialize(JS::Realm& realm)
|
|||
void MessagePort::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_remote_port.ptr());
|
||||
visitor.visit(m_remote_port);
|
||||
}
|
||||
|
||||
void MessagePort::disentangle()
|
||||
|
|
|
@ -20,7 +20,7 @@ Script::~Script() = default;
|
|||
|
||||
void Script::visit_host_defined_self(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
visitor.visit(this);
|
||||
visitor.visit(*this);
|
||||
}
|
||||
|
||||
void Script::visit_edges(Visitor& visitor)
|
||||
|
|
|
@ -23,7 +23,7 @@ WindowEnvironmentSettingsObject::~WindowEnvironmentSettingsObject() = default;
|
|||
void WindowEnvironmentSettingsObject::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_window.ptr());
|
||||
visitor.visit(m_window);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/window-object.html#set-up-a-window-environment-settings-object
|
||||
|
|
|
@ -36,7 +36,7 @@ void SubmitEvent::initialize(JS::Realm& realm)
|
|||
void SubmitEvent::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_submitter.ptr());
|
||||
visitor.visit(m_submitter);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ Timer::Timer(JS::Object& window_or_worker_global_scope, i32 milliseconds, JS::No
|
|||
void Timer::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_window_or_worker_global_scope.ptr());
|
||||
visitor.visit(m_window_or_worker_global_scope);
|
||||
visitor.visit(m_callback);
|
||||
}
|
||||
|
||||
|
|
|
@ -109,10 +109,10 @@ void Window::visit_edges(JS::Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
WindowOrWorkerGlobalScopeMixin::visit_edges(visitor);
|
||||
|
||||
visitor.visit(m_associated_document.ptr());
|
||||
visitor.visit(m_current_event.ptr());
|
||||
visitor.visit(m_performance.ptr());
|
||||
visitor.visit(m_screen.ptr());
|
||||
visitor.visit(m_associated_document);
|
||||
visitor.visit(m_current_event);
|
||||
visitor.visit(m_performance);
|
||||
visitor.visit(m_screen);
|
||||
visitor.visit(m_location);
|
||||
visitor.visit(m_crypto);
|
||||
visitor.visit(m_navigator);
|
||||
|
|
|
@ -258,7 +258,7 @@ JS::ThrowCompletionOr<JS::MarkedVector<JS::Value>> WindowProxy::internal_own_pro
|
|||
void WindowProxy::visit_edges(JS::Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_window.ptr());
|
||||
visitor.visit(m_window);
|
||||
}
|
||||
|
||||
void WindowProxy::set_window(JS::NonnullGCPtr<Window> window)
|
||||
|
|
|
@ -46,8 +46,8 @@ void WorkerGlobalScope::visit_edges(Cell::Visitor& visitor)
|
|||
Base::visit_edges(visitor);
|
||||
WindowOrWorkerGlobalScopeMixin::visit_edges(visitor);
|
||||
|
||||
visitor.visit(m_location.ptr());
|
||||
visitor.visit(m_navigator.ptr());
|
||||
visitor.visit(m_location);
|
||||
visitor.visit(m_navigator);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/workers.html#importing-scripts-and-libraries
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue