summaryrefslogtreecommitdiff
path: root/Userland/DevTools/Inspector
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2022-07-11 17:32:29 +0000
committerAndreas Kling <kling@serenityos.org>2022-07-12 23:11:35 +0200
commit3f3f45580ab7266258e97cb3cecf1e24716d61c5 (patch)
tree152c7a187c98184d58bf91a326357e0af435edcf /Userland/DevTools/Inspector
parente5f09ea1703bacfbb79a4ad3c587a7d5d3d7bb13 (diff)
downloadserenity-3f3f45580ab7266258e97cb3cecf1e24716d61c5.zip
Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
Diffstat (limited to 'Userland/DevTools/Inspector')
-rw-r--r--Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp10
-rw-r--r--Userland/DevTools/Inspector/RemoteProcess.cpp14
-rw-r--r--Userland/DevTools/Inspector/main.cpp10
3 files changed, 17 insertions, 17 deletions
diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
index 33b1c445c5..254731d23e 100644
--- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
+++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.cpp
@@ -17,10 +17,10 @@ namespace Inspector {
RemoteObjectGraphModel::RemoteObjectGraphModel(RemoteProcess& process)
: m_process(process)
{
- m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png").release_value_but_fixme_should_propagate_errors());
- m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png").release_value_but_fixme_should_propagate_errors());
- m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png").release_value_but_fixme_should_propagate_errors());
- m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png").release_value_but_fixme_should_propagate_errors());
+ m_object_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/inspector-object.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_window_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/window.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_layout_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/layout.png"sv).release_value_but_fixme_should_propagate_errors());
+ m_timer_icon.set_bitmap_for_size(16, Gfx::Bitmap::try_load_from_file("/res/icons/16x16/timer.png"sv).release_value_but_fixme_should_propagate_errors());
}
GUI::ModelIndex RemoteObjectGraphModel::index(int row, int column, const GUI::ModelIndex& parent) const
@@ -82,7 +82,7 @@ GUI::Variant RemoteObjectGraphModel::data(const GUI::ModelIndex& index, GUI::Mod
return m_window_icon;
if (remote_object->class_name == "Timer")
return m_timer_icon;
- if (remote_object->class_name.ends_with("Layout"))
+ if (remote_object->class_name.ends_with("Layout"sv))
return m_layout_icon;
return m_object_icon;
}
diff --git a/Userland/DevTools/Inspector/RemoteProcess.cpp b/Userland/DevTools/Inspector/RemoteProcess.cpp
index 5bb52c020b..1f2f96c49d 100644
--- a/Userland/DevTools/Inspector/RemoteProcess.cpp
+++ b/Userland/DevTools/Inspector/RemoteProcess.cpp
@@ -29,10 +29,10 @@ RemoteProcess::RemoteProcess(pid_t pid)
void RemoteProcess::handle_identify_response(JsonObject const& response)
{
- int pid = response.get("pid").to_int();
+ int pid = response.get("pid"sv).to_int();
VERIFY(pid == m_pid);
- m_process_name = response.get("process_name").as_string_or({});
+ m_process_name = response.get("process_name"sv).as_string_or({});
if (on_update)
on_update();
@@ -41,7 +41,7 @@ void RemoteProcess::handle_identify_response(JsonObject const& response)
void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
{
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
- auto objects = response.get("objects");
+ auto objects = response.get("objects"sv);
auto& object_array = objects.as_array();
NonnullOwnPtrVector<RemoteObject> remote_objects;
@@ -51,10 +51,10 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
VERIFY(value.is_object());
auto& object = value.as_object();
auto remote_object = make<RemoteObject>();
- remote_object->address = object.get("address").to_number<FlatPtr>();
- remote_object->parent_address = object.get("parent").to_number<FlatPtr>();
- remote_object->name = object.get("name").to_string();
- remote_object->class_name = object.get("class_name").to_string();
+ remote_object->address = object.get("address"sv).to_number<FlatPtr>();
+ remote_object->parent_address = object.get("parent"sv).to_number<FlatPtr>();
+ remote_object->name = object.get("name"sv).to_string();
+ remote_object->class_name = object.get("class_name"sv).to_string();
remote_object->json = object;
objects_by_address.set(remote_object->address, remote_object);
remote_objects.append(move(remote_object));
diff --git a/Userland/DevTools/Inspector/main.cpp b/Userland/DevTools/Inspector/main.cpp
index 512cb7bfdf..bf0fce471c 100644
--- a/Userland/DevTools/Inspector/main.cpp
+++ b/Userland/DevTools/Inspector/main.cpp
@@ -48,10 +48,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
pid_t pid;
auto app = TRY(GUI::Application::try_create(arguments));
- auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-inspector"));
+ auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-inspector"sv));
if (gui_mode) {
choose_pid:
- auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector", "Inspect", app_icon.bitmap_for_size(16)));
+ auto process_chooser = TRY(GUI::ProcessChooser::try_create("Inspector"sv, "Inspect"sv, app_icon.bitmap_for_size(16)));
if (process_chooser->exec() == GUI::Dialog::ExecResult::Cancel)
return 0;
pid = process_chooser->pid();
@@ -65,13 +65,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto window = TRY(GUI::Window::try_create());
if (pid == getpid()) {
- GUI::MessageBox::show(window, "Cannot inspect Inspector itself!", "Error", GUI::MessageBox::Type::Error);
+ GUI::MessageBox::show(window, "Cannot inspect Inspector itself!"sv, "Error"sv, GUI::MessageBox::Type::Error);
return 1;
}
RemoteProcess remote_process(pid);
if (!remote_process.is_inspectable()) {
- GUI::MessageBox::show(window, String::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error", GUI::MessageBox::Type::Error);
+ GUI::MessageBox::show(window, String::formatted("Process pid={} is not inspectable", remote_process.pid()), "Error"sv, GUI::MessageBox::Type::Error);
if (gui_mode) {
goto choose_pid;
} else {
@@ -126,7 +126,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto properties_tree_view_context_menu = TRY(GUI::Menu::try_create("Properties Tree View"));
- auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png").release_value_but_fixme_should_propagate_errors();
+ auto copy_bitmap = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/edit-copy.png"sv).release_value_but_fixme_should_propagate_errors();
auto copy_property_name_action = GUI::Action::create("Copy Property Name", copy_bitmap, [&](auto&) {
GUI::Clipboard::the().set_plain_text(properties_tree_view.selection().first().data().to_string());
});