From 071d72b49433be1d8d400d0c70b0aae680096638 Mon Sep 17 00:00:00 2001 From: Hendiadyoin1 Date: Wed, 22 Dec 2021 16:51:04 +0100 Subject: [PATCH] Profiler: Always use FlyString const&'s in ProfileNode construction No need to copy and move them around, just to pass them as a `String const&` to the constructor. We still end up copying it to a normal String in the end though... --- Userland/DevTools/Profiler/Profile.cpp | 2 +- Userland/DevTools/Profiler/Profile.h | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index 3664720b86..f5acbeb8f7 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -563,7 +563,7 @@ ProfileNode::ProfileNode(Process const& process) { } -ProfileNode::ProfileNode(Process const& process, const String& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) +ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) : m_process(process) , m_symbol(move(symbol)) , m_pid(pid) diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 876a044248..e153a9bc70 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -32,9 +32,9 @@ extern OwnPtr g_kernel_debug_info; class ProfileNode : public RefCounted { public: - static NonnullRefPtr create(Process const& process, FlyString object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + static NonnullRefPtr create(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) { - return adopt_ref(*new ProfileNode(process, move(object_name), move(symbol), address, offset, timestamp, pid)); + return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid)); } static NonnullRefPtr create_process_node(Process const& process) @@ -72,7 +72,7 @@ public: m_children.append(child); } - ProfileNode& find_or_create_child(FlyString object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + ProfileNode& find_or_create_child(FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) { for (size_t i = 0; i < m_children.size(); ++i) { auto& child = m_children[i]; @@ -80,7 +80,7 @@ public: return child; } } - auto new_child = ProfileNode::create(m_process, move(object_name), move(symbol), address, offset, timestamp, pid); + auto new_child = ProfileNode::create(m_process, object_name, move(symbol), address, offset, timestamp, pid); add_child(new_child); return new_child; }; @@ -110,7 +110,7 @@ public: private: explicit ProfileNode(Process const&); - explicit ProfileNode(Process const&, const String& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); + explicit ProfileNode(Process const&, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); bool m_root { false }; Process const& m_process;