mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibJS+LibWeb: Use GC::Weak instead of AK::WeakPtr for GC-allocated types
This makes some common types like JS::Object smaller (by 8 bytes) and yields a minor speed improvement on many benchmarks.
This commit is contained in:
committed by
Andreas Kling
parent
25a5ed94d6
commit
dfa796a4e4
Notes:
github-actions[bot]
2025-10-17 15:25:08 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/dfa796a4e45 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6496
@@ -68,7 +68,7 @@ void Page::set_focused_navigable(Badge<EventHandler>, HTML::Navigable& navigable
|
||||
void Page::navigable_document_destroyed(Badge<DOM::Document>, HTML::Navigable& navigable)
|
||||
{
|
||||
if (&navigable == m_focused_navigable.ptr())
|
||||
m_focused_navigable.clear();
|
||||
m_focused_navigable = nullptr;
|
||||
}
|
||||
|
||||
void Page::load(URL::URL const& url)
|
||||
@@ -405,7 +405,7 @@ void Page::on_pending_dialog_closed()
|
||||
}
|
||||
}
|
||||
|
||||
void Page::did_request_color_picker(WeakPtr<HTML::HTMLInputElement> target, Color current_color)
|
||||
void Page::did_request_color_picker(GC::Weak<HTML::HTMLInputElement> target, Color current_color)
|
||||
{
|
||||
if (m_pending_non_blocking_dialog == PendingNonBlockingDialog::None) {
|
||||
m_pending_non_blocking_dialog = PendingNonBlockingDialog::ColorPicker;
|
||||
@@ -425,12 +425,12 @@ void Page::color_picker_update(Optional<Color> picked_color, HTML::ColorPickerUp
|
||||
auto& input_element = as<HTML::HTMLInputElement>(*m_pending_non_blocking_dialog_target);
|
||||
input_element.did_pick_color(move(picked_color), state);
|
||||
if (state == HTML::ColorPickerUpdateState::Closed)
|
||||
m_pending_non_blocking_dialog_target.clear();
|
||||
m_pending_non_blocking_dialog_target = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::did_request_file_picker(WeakPtr<HTML::HTMLInputElement> target, HTML::FileFilter const& accepted_file_types, HTML::AllowMultipleFiles allow_multiple_files)
|
||||
void Page::did_request_file_picker(GC::Weak<HTML::HTMLInputElement> target, HTML::FileFilter const& accepted_file_types, HTML::AllowMultipleFiles allow_multiple_files)
|
||||
{
|
||||
if (m_pending_non_blocking_dialog == PendingNonBlockingDialog::None) {
|
||||
m_pending_non_blocking_dialog = PendingNonBlockingDialog::FilePicker;
|
||||
@@ -449,12 +449,12 @@ void Page::file_picker_closed(Span<HTML::SelectedFile> selected_files)
|
||||
auto& input_element = as<HTML::HTMLInputElement>(*m_pending_non_blocking_dialog_target);
|
||||
input_element.did_select_files(selected_files);
|
||||
|
||||
m_pending_non_blocking_dialog_target.clear();
|
||||
m_pending_non_blocking_dialog_target = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Page::did_request_select_dropdown(WeakPtr<HTML::HTMLSelectElement> target, Web::CSSPixelPoint content_position, Web::CSSPixels minimum_width, Vector<Web::HTML::SelectItem> items)
|
||||
void Page::did_request_select_dropdown(GC::Weak<HTML::HTMLSelectElement> target, Web::CSSPixelPoint content_position, Web::CSSPixels minimum_width, Vector<Web::HTML::SelectItem> items)
|
||||
{
|
||||
if (m_pending_non_blocking_dialog == PendingNonBlockingDialog::None) {
|
||||
m_pending_non_blocking_dialog = PendingNonBlockingDialog::Select;
|
||||
@@ -471,7 +471,7 @@ void Page::select_dropdown_closed(Optional<u32> const& selected_item_id)
|
||||
if (m_pending_non_blocking_dialog_target) {
|
||||
auto& select_element = as<HTML::HTMLSelectElement>(*m_pending_non_blocking_dialog_target);
|
||||
select_element.did_select_item(selected_item_id);
|
||||
m_pending_non_blocking_dialog_target.clear();
|
||||
m_pending_non_blocking_dialog_target = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user