LibJS+LibWeb: Rename Heap::allocate_without_realm to Heap::allocate

Now that the heap has no knowledge about a JavaScript realm and is
purely for managing the memory of the heap, it does not make sense
to name this function to say that it is a non-realm variant.
This commit is contained in:
Shannon Booth 2024-11-14 06:13:46 +13:00 committed by Tim Flynn
commit 1e54003cb1
Notes: github-actions[bot] 2024-11-13 21:52:39 +00:00
115 changed files with 243 additions and 243 deletions

View file

@ -4201,7 +4201,7 @@ void Document::start_intersection_observing_a_lazy_loading_element(Element& elem
// Spec Note: This allows for fetching the image during scrolling, when it does not yet — but is about to — intersect the viewport.
auto options = IntersectionObserver::IntersectionObserverInit {};
auto wrapped_callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(callback, Bindings::principal_host_defined_environment_settings_object(realm));
auto wrapped_callback = realm.heap().allocate<WebIDL::CallbackType>(callback, Bindings::principal_host_defined_environment_settings_object(realm));
m_lazy_load_intersection_observer = IntersectionObserver::IntersectionObserver::construct_impl(realm, wrapped_callback, options).release_value_but_fixme_should_propagate_errors();
}

View file

@ -55,7 +55,7 @@ JS::NonnullGCPtr<DOM::Document> create_document_for_inline_content(JS::GCPtr<HTM
// about base URL: null
auto response = Fetch::Infrastructure::Response::create(vm);
response->url_list().append(URL::URL("about:error")); // AD-HOC: https://github.com/whatwg/html/issues/9122
auto navigation_params = vm.heap().allocate_without_realm<HTML::NavigationParams>();
auto navigation_params = vm.heap().allocate<HTML::NavigationParams>();
navigation_params->id = navigation_id;
navigation_params->navigable = navigable;
navigation_params->request = nullptr;

View file

@ -398,17 +398,17 @@ JS::GCPtr<Layout::Node> Element::create_layout_node(CSS::StyleProperties style)
JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DOM::Document& document, CSS::Display const& display, CSS::StyleProperties style, Element* element)
{
if (display.is_table_inside() || display.is_table_row_group() || display.is_table_header_group() || display.is_table_footer_group() || display.is_table_row())
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
return document.heap().allocate<Layout::Box>(document, element, move(style));
if (display.is_list_item())
return document.heap().allocate_without_realm<Layout::ListItemBox>(document, element, move(style));
return document.heap().allocate<Layout::ListItemBox>(document, element, move(style));
if (display.is_table_cell())
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
return document.heap().allocate<Layout::BlockContainer>(document, element, move(style));
if (display.is_table_column() || display.is_table_column_group() || display.is_table_caption()) {
// FIXME: This is just an incorrect placeholder until we improve table layout support.
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
return document.heap().allocate<Layout::BlockContainer>(document, element, move(style));
}
if (display.is_math_inside()) {
@ -416,30 +416,30 @@ JS::GCPtr<Layout::NodeWithStyle> Element::create_layout_node_for_display_type(DO
// MathML elements with a computed display value equal to block math or inline math control box generation
// and layout according to their tag name, as described in the relevant sections.
// FIXME: Figure out what kind of node we should make for them. For now, we'll stick with a generic Box.
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
return document.heap().allocate<Layout::BlockContainer>(document, element, move(style));
}
if (display.is_inline_outside()) {
if (display.is_flow_root_inside())
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
return document.heap().allocate<Layout::BlockContainer>(document, element, move(style));
if (display.is_flow_inside())
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
return document.heap().allocate<Layout::InlineNode>(document, element, move(style));
if (display.is_flex_inside())
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
return document.heap().allocate<Layout::Box>(document, element, move(style));
if (display.is_grid_inside())
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
return document.heap().allocate<Layout::Box>(document, element, move(style));
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", display.to_string());
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
return document.heap().allocate<Layout::InlineNode>(document, element, move(style));
}
if (display.is_flex_inside() || display.is_grid_inside())
return document.heap().allocate_without_realm<Layout::Box>(document, element, move(style));
return document.heap().allocate<Layout::Box>(document, element, move(style));
if (display.is_flow_inside() || display.is_flow_root_inside() || display.is_contents())
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
return document.heap().allocate<Layout::BlockContainer>(document, element, move(style));
dbgln("FIXME: CSS display '{}' not implemented yet.", display.to_string());
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
return document.heap().allocate<Layout::InlineNode>(document, element, move(style));
}
void Element::run_attribute_change_steps(FlyString const& local_name, Optional<String> const& old_value, Optional<String> const& value, Optional<FlyString> const& namespace_)

View file

@ -154,7 +154,7 @@ void EventTarget::add_event_listener(FlyString const& type, IDLEventListener* ca
// 2. Add an event listener with this and an event listener whose type is type, callback is callback, capture is capture, passive is passive,
// once is once, and signal is signal.
auto event_listener = heap().allocate_without_realm<DOMEventListener>();
auto event_listener = heap().allocate<DOMEventListener>();
event_listener->type = type;
event_listener->callback = callback;
event_listener->signal = move(flattened_options.signal);
@ -499,7 +499,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
function->set_script_or_module({});
// 12. Set eventHandler's value to the result of creating a Web IDL EventHandler callback function object whose object reference is function and whose callback context is settings object.
event_handler->value = JS::GCPtr(realm.heap().allocate_without_realm<WebIDL::CallbackType>(*function, settings_object));
event_handler->value = JS::GCPtr(realm.heap().allocate<WebIDL::CallbackType>(*function, settings_object));
}
// 4. Return eventHandler's value.
@ -533,7 +533,7 @@ void EventTarget::set_event_handler_attribute(FlyString const& name, WebIDL::Cal
// 3. Set eventHandler's value to the given value.
if (event_handler_iterator == handler_map.end()) {
// NOTE: See the optimization comment in get_current_value_of_event_handler about why this is done.
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(*value);
auto new_event_handler = heap().allocate<HTML::EventHandler>(*value);
// 4. Activate an event handler given eventTarget and name.
// Optimization: We pass in the event handler here instead of having activate_event_handler do another hash map lookup just to get the same object.
@ -591,10 +591,10 @@ void EventTarget::activate_event_handler(FlyString const& name, HTML::EventHandl
0, "", &realm);
// NOTE: As per the spec, the callback context is arbitrary.
auto callback = realm.heap().allocate_without_realm<WebIDL::CallbackType>(*callback_function, Bindings::principal_host_defined_environment_settings_object(realm));
auto callback = realm.heap().allocate<WebIDL::CallbackType>(*callback_function, Bindings::principal_host_defined_environment_settings_object(realm));
// 5. Let listener be a new event listener whose type is the event handler event type corresponding to eventHandler and callback is callback.
auto listener = realm.heap().allocate_without_realm<DOMEventListener>();
auto listener = realm.heap().allocate<DOMEventListener>();
listener->type = name;
listener->callback = IDLEventListener::create(realm, *callback);
@ -759,7 +759,7 @@ void EventTarget::element_event_handler_attribute_changed(FlyString const& local
// NOTE: See the optimization comments in set_event_handler_attribute.
if (event_handler_iterator == handler_map.end()) {
auto new_event_handler = heap().allocate_without_realm<HTML::EventHandler>(value->to_byte_string());
auto new_event_handler = heap().allocate<HTML::EventHandler>(value->to_byte_string());
// 6. Activate an event handler given eventTarget and name.
event_target->activate_event_handler(local_name, *new_event_handler);

View file

@ -162,7 +162,7 @@ Vector<JS::Handle<MutationRecord>> MutationObserver::take_records()
JS::NonnullGCPtr<RegisteredObserver> RegisteredObserver::create(MutationObserver& observer, MutationObserverInit const& options)
{
return observer.heap().allocate_without_realm<RegisteredObserver>(observer, options);
return observer.heap().allocate<RegisteredObserver>(observer, options);
}
RegisteredObserver::RegisteredObserver(MutationObserver& observer, MutationObserverInit const& options)
@ -181,7 +181,7 @@ void RegisteredObserver::visit_edges(Cell::Visitor& visitor)
JS::NonnullGCPtr<TransientRegisteredObserver> TransientRegisteredObserver::create(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source)
{
return observer.heap().allocate_without_realm<TransientRegisteredObserver>(observer, options, source);
return observer.heap().allocate<TransientRegisteredObserver>(observer, options, source);
}
TransientRegisteredObserver::TransientRegisteredObserver(MutationObserver& observer, MutationObserverInit const& options, RegisteredObserver& source)