mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:17:44 +00:00
AK: Make "foo"_string infallible
Stop worrying about tiny OOMs. Work towards #20405.
This commit is contained in:
parent
db2a8725c6
commit
34344120f2
181 changed files with 626 additions and 630 deletions
|
@ -56,12 +56,12 @@ MemoryStatsWidget::MemoryStatsWidget(GraphWidget* graph)
|
|||
return label;
|
||||
};
|
||||
|
||||
m_physical_pages_label = build_widgets_for_label("Physical memory:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_physical_pages_committed_label = build_widgets_for_label("Committed memory:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_kfree_count_label = build_widgets_for_label("Calls kfree:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_kmalloc_difference_label = build_widgets_for_label("Difference:"_string.release_value_but_fixme_should_propagate_errors());
|
||||
m_physical_pages_label = build_widgets_for_label("Physical memory:"_string);
|
||||
m_physical_pages_committed_label = build_widgets_for_label("Committed memory:"_string);
|
||||
m_kmalloc_space_label = build_widgets_for_label("Kernel heap:"_string);
|
||||
m_kmalloc_count_label = build_widgets_for_label("Calls kmalloc:"_string);
|
||||
m_kfree_count_label = build_widgets_for_label("Calls kfree:"_string);
|
||||
m_kmalloc_difference_label = build_widgets_for_label("Difference:"_string);
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_adapters_fields.empend("name", "Name"_short_string, Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("class_name", "Class"_short_string, Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("mac_address", "MAC"_short_string, Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("Link status"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft,
|
||||
net_adapters_fields.empend("Link status"_string, Gfx::TextAlignment::CenterLeft,
|
||||
[](JsonObject const& object) -> DeprecatedString {
|
||||
if (!object.get_bool("link_up"sv).value_or(false))
|
||||
return "Down";
|
||||
|
@ -67,8 +67,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
});
|
||||
net_adapters_fields.empend("packets_in", "Pkt In"_short_string, Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("packets_out", "Pkt Out"_short_string, Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_in", "Bytes In"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_out", "Bytes Out"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_in", "Bytes In"_string, Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("bytes_out", "Bytes Out"_string, Gfx::TextAlignment::CenterRight);
|
||||
m_adapter_model = GUI::JsonArrayModel::create("/sys/kernel/net/adapters", move(net_adapters_fields));
|
||||
m_adapter_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_adapter_model)));
|
||||
m_adapter_context_menu = MUST(GUI::Menu::try_create());
|
||||
|
@ -106,8 +106,8 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_tcp_fields.empend("sequence_number", "Seq#"_short_string, Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("packets_in", "Pkt In"_short_string, Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("packets_out", "Pkt Out"_short_string, Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_in", "Bytes In"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_out", "Bytes Out"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_in", "Bytes In"_string, Gfx::TextAlignment::CenterRight);
|
||||
net_tcp_fields.empend("bytes_out", "Bytes Out"_string, Gfx::TextAlignment::CenterRight);
|
||||
m_tcp_socket_model = GUI::JsonArrayModel::create("/sys/kernel/net/tcp", move(net_tcp_fields));
|
||||
m_tcp_socket_table_view->set_model(MUST(GUI::SortingProxyModel::create(*m_tcp_socket_model)));
|
||||
|
||||
|
|
|
@ -29,16 +29,16 @@ ErrorOr<NonnullRefPtr<ProcessFileDescriptorMapWidget>> ProcessFileDescriptorMapW
|
|||
TRY(pid_fds_fields.try_empend("Access"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get_bool("seekable"sv).value_or(false) ? "Seekable" : "Sequential";
|
||||
}));
|
||||
TRY(pid_fds_fields.try_empend(TRY("Blocking"_string), Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
TRY(pid_fds_fields.try_empend("Blocking"_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get_bool("blocking"sv).value_or(false) ? "Blocking" : "Nonblocking";
|
||||
}));
|
||||
TRY(pid_fds_fields.try_empend("On exec"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get_bool("cloexec"sv).value_or(false) ? "Close" : "Keep";
|
||||
}));
|
||||
TRY(pid_fds_fields.try_empend(TRY("Can read"_string), Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
TRY(pid_fds_fields.try_empend("Can read"_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get_bool("can_read"sv).value_or(false) ? "Yes" : "No";
|
||||
}));
|
||||
TRY(pid_fds_fields.try_empend(TRY("Can write"_string), Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
TRY(pid_fds_fields.try_empend("Can write"_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
return object.get_bool("can_write"sv).value_or(false) ? "Yes" : "No";
|
||||
}));
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ ErrorOr<NonnullRefPtr<ProcessMemoryMapWidget>> ProcessMemoryMapWidget::try_creat
|
|||
[](auto& object) { return DeprecatedString::formatted("{:p}", object.get_u64("address"sv).value_or(0)); },
|
||||
[](auto& object) { return object.get_u64("address"sv).value_or(0); }));
|
||||
TRY(pid_vm_fields.try_empend("size", "Size"_short_string, Gfx::TextAlignment::CenterRight));
|
||||
TRY(pid_vm_fields.try_empend("amount_resident", TRY("Resident"_string), Gfx::TextAlignment::CenterRight));
|
||||
TRY(pid_vm_fields.try_empend("amount_resident", "Resident"_string, Gfx::TextAlignment::CenterRight));
|
||||
TRY(pid_vm_fields.try_empend("amount_dirty", "Dirty"_short_string, Gfx::TextAlignment::CenterRight));
|
||||
TRY(pid_vm_fields.try_empend("Access"_short_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
StringBuilder builder;
|
||||
|
@ -79,19 +79,19 @@ ErrorOr<NonnullRefPtr<ProcessMemoryMapWidget>> ProcessMemoryMapWidget::try_creat
|
|||
builder.append('T');
|
||||
return builder.to_deprecated_string();
|
||||
}));
|
||||
TRY(pid_vm_fields.try_empend(TRY("VMObject type"_string), Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
TRY(pid_vm_fields.try_empend("VMObject type"_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
auto type = object.get_deprecated_string("vmobject"sv).value_or({});
|
||||
if (type.ends_with("VMObject"sv))
|
||||
type = type.substring(0, type.length() - 8);
|
||||
return type;
|
||||
}));
|
||||
TRY(pid_vm_fields.try_empend(TRY("Purgeable"_string), Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
TRY(pid_vm_fields.try_empend("Purgeable"_string, Gfx::TextAlignment::CenterLeft, [](auto& object) {
|
||||
if (object.get_bool("volatile"sv).value_or(false))
|
||||
return "Volatile";
|
||||
return "Non-volatile";
|
||||
}));
|
||||
TRY(pid_vm_fields.try_empend(
|
||||
TRY("Page map"_string), Gfx::TextAlignment::CenterLeft,
|
||||
"Page map"_string, Gfx::TextAlignment::CenterLeft,
|
||||
[](auto&) {
|
||||
return GUI::Variant();
|
||||
},
|
||||
|
|
|
@ -95,7 +95,7 @@ ErrorOr<String> ProcessModel::column_name(int column) const
|
|||
case Column::Virtual:
|
||||
return "Virtual"_short_string;
|
||||
case Column::Physical:
|
||||
return TRY("Physical"_string);
|
||||
return "Physical"_string;
|
||||
case Column::DirtyPrivate:
|
||||
return "Private"_short_string;
|
||||
case Column::CleanInode:
|
||||
|
@ -107,11 +107,11 @@ ErrorOr<String> ProcessModel::column_name(int column) const
|
|||
case Column::CPU:
|
||||
return "CPU"_short_string;
|
||||
case Column::Processor:
|
||||
return TRY("Processor"_string);
|
||||
return "Processor"_string;
|
||||
case Column::Name:
|
||||
return "Name"_short_string;
|
||||
case Column::Syscalls:
|
||||
return TRY("Syscalls"_string);
|
||||
return "Syscalls"_string;
|
||||
case Column::InodeFaults:
|
||||
return "F:Inode"_short_string;
|
||||
case Column::ZeroFaults:
|
||||
|
@ -121,15 +121,15 @@ ErrorOr<String> ProcessModel::column_name(int column) const
|
|||
case Column::IPv4SocketReadBytes:
|
||||
return "IPv4 In"_short_string;
|
||||
case Column::IPv4SocketWriteBytes:
|
||||
return TRY("IPv4 Out"_string);
|
||||
return "IPv4 Out"_string;
|
||||
case Column::UnixSocketReadBytes:
|
||||
return "Unix In"_short_string;
|
||||
case Column::UnixSocketWriteBytes:
|
||||
return TRY("Unix Out"_string);
|
||||
return "Unix Out"_string;
|
||||
case Column::FileReadBytes:
|
||||
return "File In"_short_string;
|
||||
case Column::FileWriteBytes:
|
||||
return TRY("File Out"_string);
|
||||
return "File Out"_string;
|
||||
case Column::Pledge:
|
||||
return "Pledge"_short_string;
|
||||
case Column::Veil:
|
||||
|
|
|
@ -24,7 +24,7 @@ ErrorOr<NonnullRefPtr<ProcessUnveiledPathsWidget>> ProcessUnveiledPathsWidget::t
|
|||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> pid_unveil_fields;
|
||||
TRY(pid_unveil_fields.try_empend("path", "Path"_short_string, Gfx::TextAlignment::CenterLeft));
|
||||
TRY(pid_unveil_fields.try_empend("permissions", TRY("Permissions"_string), Gfx::TextAlignment::CenterLeft));
|
||||
TRY(pid_unveil_fields.try_empend("permissions", "Permissions"_string, Gfx::TextAlignment::CenterLeft));
|
||||
|
||||
widget->m_model = GUI::JsonArrayModel::create({}, move(pid_unveil_fields));
|
||||
widget->m_table_view->set_model(TRY(GUI::SortingProxyModel::create(*widget->m_model)));
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
auto& fs_table_view = *self.find_child_of_type_named<GUI::TableView>("storage_table");
|
||||
|
||||
Vector<GUI::JsonArrayModel::FieldSpec> df_fields;
|
||||
df_fields.empend("mount_point", "Mount point"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft);
|
||||
df_fields.empend("mount_point", "Mount point"_string, Gfx::TextAlignment::CenterLeft);
|
||||
df_fields.empend("class_name", "Class"_short_string, Gfx::TextAlignment::CenterLeft);
|
||||
df_fields.empend("source", "Source"_short_string, Gfx::TextAlignment::CenterLeft);
|
||||
df_fields.empend(
|
||||
|
@ -161,7 +161,7 @@ public:
|
|||
return used_blocks * object.get_u64("block_size"sv).value_or(0);
|
||||
});
|
||||
df_fields.empend(
|
||||
"Available"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight,
|
||||
"Available"_string, Gfx::TextAlignment::CenterRight,
|
||||
[](JsonObject const& object) {
|
||||
return human_readable_size(object.get_u64("free_block_count"sv).value_or(0) * object.get_u64("block_size"sv).value_or(0));
|
||||
},
|
||||
|
@ -173,7 +173,7 @@ public:
|
|||
int mount_flags = object.get_i32("mount_flags"sv).value_or(0);
|
||||
return readonly || (mount_flags & MS_RDONLY) ? "Read-only" : "Read/Write";
|
||||
});
|
||||
df_fields.empend("Mount flags"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) {
|
||||
df_fields.empend("Mount flags"_string, Gfx::TextAlignment::CenterLeft, [](JsonObject const& object) {
|
||||
int mount_flags = object.get_i32("mount_flags"sv).value_or(0);
|
||||
StringBuilder builder;
|
||||
bool first = true;
|
||||
|
@ -197,11 +197,11 @@ public:
|
|||
return DeprecatedString("defaults");
|
||||
return builder.to_deprecated_string();
|
||||
});
|
||||
df_fields.empend("free_block_count", "Free blocks"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("total_block_count", "Total blocks"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("free_inode_count", "Free inodes"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("total_inode_count", "Total inodes"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("block_size", "Block size"_string.release_value_but_fixme_should_propagate_errors(), Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("free_block_count", "Free blocks"_string, Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("total_block_count", "Total blocks"_string, Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("free_inode_count", "Free inodes"_string, Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("total_inode_count", "Total inodes"_string, Gfx::TextAlignment::CenterRight);
|
||||
df_fields.empend("block_size", "Block size"_string, Gfx::TextAlignment::CenterRight);
|
||||
|
||||
fs_table_view.set_model(MUST(GUI::SortingProxyModel::create(GUI::JsonArrayModel::create("/sys/kernel/df", move(df_fields)))));
|
||||
|
||||
|
@ -446,7 +446,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
process_context_menu->popup(event.screen_position(), process_properties_action);
|
||||
};
|
||||
|
||||
auto frequency_menu = TRY(window->try_add_menu(TRY("F&requency"_string)));
|
||||
auto frequency_menu = TRY(window->try_add_menu("F&requency"_string));
|
||||
GUI::ActionGroup frequency_action_group;
|
||||
frequency_action_group.set_exclusive(true);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue