From 6e19ab2bbce0b113b628e6f8e9b5c0640053933e Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 4 Dec 2022 18:02:33 +0000 Subject: AK+Everywhere: Rename String to DeprecatedString We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^) --- Userland/DevTools/Profiler/DisassemblyModel.cpp | 6 +++--- Userland/DevTools/Profiler/DisassemblyModel.h | 4 ++-- .../DevTools/Profiler/FilesystemEventModel.cpp | 6 +++--- Userland/DevTools/Profiler/FilesystemEventModel.h | 16 ++++++++-------- Userland/DevTools/Profiler/FlameGraphView.cpp | 6 +++--- Userland/DevTools/Profiler/FlameGraphView.h | 2 +- .../DevTools/Profiler/IndividualSampleModel.cpp | 4 ++-- Userland/DevTools/Profiler/IndividualSampleModel.h | 2 +- Userland/DevTools/Profiler/Process.cpp | 22 +++++++++++----------- Userland/DevTools/Profiler/Process.h | 14 +++++++------- Userland/DevTools/Profiler/Profile.cpp | 14 +++++++------- Userland/DevTools/Profiler/Profile.h | 22 +++++++++++----------- Userland/DevTools/Profiler/ProfileModel.cpp | 8 ++++---- Userland/DevTools/Profiler/ProfileModel.h | 2 +- Userland/DevTools/Profiler/SamplesModel.cpp | 2 +- Userland/DevTools/Profiler/SamplesModel.h | 2 +- Userland/DevTools/Profiler/SignpostsModel.cpp | 2 +- Userland/DevTools/Profiler/SignpostsModel.h | 2 +- Userland/DevTools/Profiler/SourceModel.cpp | 10 +++++----- Userland/DevTools/Profiler/SourceModel.h | 6 +++--- Userland/DevTools/Profiler/TimelineHeader.cpp | 2 +- Userland/DevTools/Profiler/TimelineHeader.h | 2 +- Userland/DevTools/Profiler/TimelineTrack.cpp | 2 +- Userland/DevTools/Profiler/main.cpp | 22 +++++++++++----------- 24 files changed, 90 insertions(+), 90 deletions(-) (limited to 'Userland/DevTools/Profiler') diff --git a/Userland/DevTools/Profiler/DisassemblyModel.cpp b/Userland/DevTools/Profiler/DisassemblyModel.cpp index b43512e6d7..564d5d0ff0 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.cpp +++ b/Userland/DevTools/Profiler/DisassemblyModel.cpp @@ -48,7 +48,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node) if (elf == nullptr) return; if (g_kernel_debug_info == nullptr) - g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, String::empty(), base_address); + g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address); debug_info = g_kernel_debug_info.ptr(); } else { auto const& process = node.process(); @@ -128,7 +128,7 @@ int DisassemblyModel::row_count(GUI::ModelIndex const&) const return m_instructions.size(); } -String DisassemblyModel::column_name(int column) const +DeprecatedString DisassemblyModel::column_name(int column) const { switch (column) { case Column::SampleCount: @@ -192,7 +192,7 @@ GUI::Variant DisassemblyModel::data(GUI::ModelIndex const& index, GUI::ModelRole } if (index.column() == Column::Address) - return String::formatted("{:p}", insn.address); + return DeprecatedString::formatted("{:p}", insn.address); if (index.column() == Column::InstructionBytes) { StringBuilder builder; diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h index e1f419ec29..77dd6662a2 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.h +++ b/Userland/DevTools/Profiler/DisassemblyModel.h @@ -18,7 +18,7 @@ class ProfileNode; struct InstructionData { X86::Instruction insn; - String disassembly; + DeprecatedString disassembly; StringView bytes; FlatPtr address { 0 }; u32 event_count { 0 }; @@ -46,7 +46,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.cpp b/Userland/DevTools/Profiler/FilesystemEventModel.cpp index 5dfe289949..246fbff744 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.cpp +++ b/Userland/DevTools/Profiler/FilesystemEventModel.cpp @@ -22,7 +22,7 @@ FileEventModel::~FileEventModel() { } -FileEventNode& FileEventNode::find_or_create_node(String const& searched_path) +FileEventNode& FileEventNode::find_or_create_node(DeprecatedString const& searched_path) { // TODO: Optimize this function. @@ -61,7 +61,7 @@ FileEventNode& FileEventNode::find_or_create_node(String const& searched_path) } } -FileEventNode& FileEventNode::create_recursively(String new_path) +FileEventNode& FileEventNode::create_recursively(DeprecatedString new_path) { auto const lex_path = LexicalPath(new_path); auto parts = lex_path.parts(); @@ -142,7 +142,7 @@ int FileEventModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String FileEventModel::column_name(int column) const +DeprecatedString FileEventModel::column_name(int column) const { switch (column) { case Column::Path: diff --git a/Userland/DevTools/Profiler/FilesystemEventModel.h b/Userland/DevTools/Profiler/FilesystemEventModel.h index afea32653a..697be2e3c1 100644 --- a/Userland/DevTools/Profiler/FilesystemEventModel.h +++ b/Userland/DevTools/Profiler/FilesystemEventModel.h @@ -6,9 +6,9 @@ #pragma once +#include #include #include -#include #include namespace Profiler { @@ -17,23 +17,23 @@ class Profile; class FileEventNode : public RefCounted { public: - static NonnullRefPtr create(String const& path, FileEventNode* parent = nullptr) + static NonnullRefPtr create(DeprecatedString const& path, FileEventNode* parent = nullptr) { return adopt_ref(*new FileEventNode(path, parent)); } - FileEventNode& find_or_create_node(String const&); + FileEventNode& find_or_create_node(DeprecatedString const&); Vector>& children() { return m_children; } Vector> const& children() const { return m_children; } FileEventNode* parent() { return m_parent; }; - FileEventNode& create_recursively(String); + FileEventNode& create_recursively(DeprecatedString); void for_each_parent_node(Function callback); - String const& path() const { return m_path; } + DeprecatedString const& path() const { return m_path; } void increment_count() { m_count++; } u64 count() const { return m_count; } @@ -42,13 +42,13 @@ public: u64 duration() const { return m_duration; } private: - FileEventNode(String const& path, FileEventNode* parent = nullptr) + FileEventNode(DeprecatedString const& path, FileEventNode* parent = nullptr) : m_path(path) , m_count(0) , m_duration(0) , m_parent(parent) {}; - String m_path; + DeprecatedString m_path; u64 m_count; u64 m_duration; @@ -74,7 +74,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/FlameGraphView.cpp b/Userland/DevTools/Profiler/FlameGraphView.cpp index 35f3382832..e151c593a9 100644 --- a/Userland/DevTools/Profiler/FlameGraphView.cpp +++ b/Userland/DevTools/Profiler/FlameGraphView.cpp @@ -89,7 +89,7 @@ void FlameGraphView::mousemove_event(GUI::MouseEvent& event) if (on_hover_change) on_hover_change(); - String label = ""; + DeprecatedString label = ""; if (m_hovered_bar != nullptr && m_hovered_bar->index.is_valid()) { label = bar_label(*m_hovered_bar); } @@ -175,10 +175,10 @@ void FlameGraphView::paint_event(GUI::PaintEvent& event) } } -String FlameGraphView::bar_label(StackBar const& bar) const +DeprecatedString FlameGraphView::bar_label(StackBar const& bar) const { auto label_index = bar.index.sibling_at_column(m_text_column); - String label = "All"; + DeprecatedString label = "All"; if (label_index.is_valid()) { label = m_model.data(label_index).to_string(); } diff --git a/Userland/DevTools/Profiler/FlameGraphView.h b/Userland/DevTools/Profiler/FlameGraphView.h index 97035e3d8b..ca98ebe647 100644 --- a/Userland/DevTools/Profiler/FlameGraphView.h +++ b/Userland/DevTools/Profiler/FlameGraphView.h @@ -46,7 +46,7 @@ private: bool selected; }; - String bar_label(StackBar const&) const; + DeprecatedString bar_label(StackBar const&) const; void layout_bars(); void layout_children(GUI::ModelIndex& parent, int depth, int left, int right, Vector& selected); diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.cpp b/Userland/DevTools/Profiler/IndividualSampleModel.cpp index ba27683f58..715a9ef4e2 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.cpp +++ b/Userland/DevTools/Profiler/IndividualSampleModel.cpp @@ -29,7 +29,7 @@ int IndividualSampleModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String IndividualSampleModel::column_name(int column) const +DeprecatedString IndividualSampleModel::column_name(int column) const { switch (column) { case Column::Address: @@ -50,7 +50,7 @@ GUI::Variant IndividualSampleModel::data(GUI::ModelIndex const& index, GUI::Mode if (role == GUI::ModelRole::Display) { if (index.column() == Column::Address) - return String::formatted("{:p}", frame.address); + return DeprecatedString::formatted("{:p}", frame.address); if (index.column() == Column::Symbol) { return frame.symbol; diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h index d499f62338..5487c6fd51 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.h +++ b/Userland/DevTools/Profiler/IndividualSampleModel.h @@ -31,7 +31,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; private: diff --git a/Userland/DevTools/Profiler/Process.cpp b/Userland/DevTools/Profiler/Process.cpp index f2c09a4032..6dc67b33d2 100644 --- a/Userland/DevTools/Profiler/Process.cpp +++ b/Userland/DevTools/Profiler/Process.cpp @@ -41,9 +41,9 @@ void Process::handle_thread_exit(pid_t tid, EventSerialNumber serial) thread->end_valid = serial; } -HashMap> g_mapped_object_cache; +HashMap> g_mapped_object_cache; -static MappedObject* get_or_create_mapped_object(String const& path) +static MappedObject* get_or_create_mapped_object(DeprecatedString const& path) { if (auto it = g_mapped_object_cache.find(path); it != g_mapped_object_cache.end()) return it->value.ptr(); @@ -67,7 +67,7 @@ static MappedObject* get_or_create_mapped_object(String const& path) return ptr; } -void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) +void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name) { StringView path; if (name.contains("Loader.so"sv)) @@ -82,25 +82,25 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) // associated base address and size as new regions are discovered. // We don't allocate a temporary String object if an entry already exists. - // This assumes that String::hash and StringView::hash return the same result. + // This assumes that DeprecatedString::hash and StringView::hash return the same result. auto string_view_compare = [&path](auto& entry) { return path == entry.key.view(); }; if (auto existing_it = m_libraries.find(path.hash(), string_view_compare); existing_it != m_libraries.end()) { auto& entry = *existing_it->value; entry.base = min(entry.base, base); entry.size = max(entry.size + size, base - entry.base + size); } else { - String path_string = path.to_string(); - String full_path; + DeprecatedString path_string = path.to_string(); + DeprecatedString full_path; if (path_string.starts_with('/')) full_path = path_string; else if (Core::File::looks_like_shared_library(path_string)) - full_path = String::formatted("/usr/lib/{}", path); + full_path = DeprecatedString::formatted("/usr/lib/{}", path); else full_path = path_string; auto* mapped_object = get_or_create_mapped_object(full_path); if (!mapped_object) { - full_path = String::formatted("/usr/local/lib/{}", path); + full_path = DeprecatedString::formatted("/usr/local/lib/{}", path); mapped_object = get_or_create_mapped_object(full_path); if (!mapped_object) return; @@ -112,14 +112,14 @@ void LibraryMetadata::handle_mmap(FlatPtr base, size_t size, String const& name) Debug::DebugInfo const& LibraryMetadata::Library::load_debug_info(FlatPtr base_address) const { if (debug_info == nullptr) - debug_info = make(object->elf, String::empty(), base_address); + debug_info = make(object->elf, DeprecatedString::empty(), base_address); return *debug_info.ptr(); } -String LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const +DeprecatedString LibraryMetadata::Library::symbolicate(FlatPtr ptr, u32* offset) const { if (!object) - return String::formatted("?? <{:p}>", ptr); + return DeprecatedString::formatted("?? <{:p}>", ptr); return object->elf.symbolicate(ptr - base, offset); } diff --git a/Userland/DevTools/Profiler/Process.h b/Userland/DevTools/Profiler/Process.h index 3d059d1e66..f47f7c5d18 100644 --- a/Userland/DevTools/Profiler/Process.h +++ b/Userland/DevTools/Profiler/Process.h @@ -21,27 +21,27 @@ struct MappedObject { ELF::Image elf; }; -extern HashMap> g_mapped_object_cache; +extern HashMap> g_mapped_object_cache; class LibraryMetadata { public: struct Library { FlatPtr base; size_t size; - String name; + DeprecatedString name; MappedObject* object { nullptr }; // This is loaded lazily because we only need it in disassembly view mutable OwnPtr debug_info; - String symbolicate(FlatPtr, u32* offset) const; + DeprecatedString symbolicate(FlatPtr, u32* offset) const; Debug::DebugInfo const& load_debug_info(FlatPtr base_address) const; }; - void handle_mmap(FlatPtr base, size_t size, String const& name); + void handle_mmap(FlatPtr base, size_t size, DeprecatedString const& name); Library const* library_containing(FlatPtr) const; private: - mutable HashMap> m_libraries; + mutable HashMap> m_libraries; }; struct Thread { @@ -57,8 +57,8 @@ struct Thread { struct Process { pid_t pid {}; - String executable; - String basename; + DeprecatedString executable; + DeprecatedString basename; HashMap> threads {}; LibraryMetadata library_metadata {}; EventSerialNumber start_valid; diff --git a/Userland/DevTools/Profiler/Profile.cpp b/Userland/DevTools/Profiler/Profile.cpp index f9f7c8c369..d1170f3b11 100644 --- a/Userland/DevTools/Profiler/Profile.cpp +++ b/Userland/DevTools/Profiler/Profile.cpp @@ -257,7 +257,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path if (!strings_value || !strings_value->is_array()) return Error::from_string_literal("Malformed profile (strings is not an array)"); - HashMap profile_strings; + HashMap profile_strings; for (FlatPtr string_id = 0; string_id < strings_value->as_array().size(); ++string_id) { auto const& value = strings_value->as_array().at(string_id); profile_strings.set(string_id, value.to_string()); @@ -302,7 +302,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path } else if (type_string == "signpost"sv) { auto string_id = perf_event.get("arg1"sv).to_number(); event.data = Event::SignpostData { - .string = profile_strings.get(string_id).value_or(String::formatted("Signpost #{}", string_id)), + .string = profile_strings.get(string_id).value_or(DeprecatedString::formatted("Signpost #{}", string_id)), .arg = perf_event.get("arg2"sv).to_number(), }; } else if (type_string == "mmap"sv) { @@ -411,13 +411,13 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path auto ptr = frame.to_number(); u32 offset = 0; FlyString object_name; - String symbol; + DeprecatedString symbol; if (maybe_kernel_base.has_value() && ptr >= maybe_kernel_base.value()) { if (g_kernel_debuginfo_object.has_value()) { symbol = g_kernel_debuginfo_object->elf.symbolicate(ptr - maybe_kernel_base.value(), &offset); } else { - symbol = String::formatted("?? <{:p}>", ptr); + symbol = DeprecatedString::formatted("?? <{:p}>", ptr); } } else { auto it = current_processes.find(event.pid); @@ -429,7 +429,7 @@ ErrorOr> Profile::load_from_perfcore_file(StringView path object_name = library->name; symbol = library->symbolicate(ptr, &offset); } else { - symbol = String::formatted("?? <{:p}>", ptr); + symbol = DeprecatedString::formatted("?? <{:p}>", ptr); } } @@ -610,7 +610,7 @@ ProfileNode::ProfileNode(Process const& process) { } -ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) +ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) : m_process(process) , m_symbol(move(symbol)) , m_pid(pid) @@ -618,7 +618,7 @@ ProfileNode::ProfileNode(Process const& process, FlyString const& object_name, S , m_offset(offset) , m_timestamp(timestamp) { - String object; + DeprecatedString object; if (object_name.ends_with(": .text"sv)) { object = object_name.view().substring_view(0, object_name.length() - 7); } else { diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 27f24d4817..eb374002a0 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -34,7 +34,7 @@ extern OwnPtr g_kernel_debug_info; class ProfileNode : public RefCounted { public: - static NonnullRefPtr create(Process const& process, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + static NonnullRefPtr create(Process const& process, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) { return adopt_ref(*new ProfileNode(process, object_name, move(symbol), address, offset, timestamp, pid)); } @@ -54,7 +54,7 @@ public: void did_see_event(size_t event_index) { m_seen_events.set(event_index, true); } FlyString const& object_name() const { return m_object_name; } - String const& symbol() const { return m_symbol; } + DeprecatedString const& symbol() const { return m_symbol; } FlatPtr address() const { return m_address; } u32 offset() const { return m_offset; } u64 timestamp() const { return m_timestamp; } @@ -74,7 +74,7 @@ public: m_children.append(child); } - ProfileNode& find_or_create_child(FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t pid) + ProfileNode& find_or_create_child(FlyString const& object_name, DeprecatedString 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]; @@ -112,13 +112,13 @@ public: private: explicit ProfileNode(Process const&); - explicit ProfileNode(Process const&, FlyString const& object_name, String symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); + explicit ProfileNode(Process const&, FlyString const& object_name, DeprecatedString symbol, FlatPtr address, u32 offset, u64 timestamp, pid_t); bool m_root { false }; Process const& m_process; ProfileNode* m_parent { nullptr }; FlyString m_object_name; - String m_symbol; + DeprecatedString m_symbol; pid_t m_pid { 0 }; FlatPtr m_address { 0 }; u32 m_offset { 0 }; @@ -167,7 +167,7 @@ public: struct Frame { FlyString object_name; - String symbol; + DeprecatedString symbol; FlatPtr address { 0 }; u32 offset { 0 }; }; @@ -195,14 +195,14 @@ public: }; struct SignpostData { - String string; + DeprecatedString string; FlatPtr arg {}; }; struct MmapData { FlatPtr ptr {}; size_t size {}; - String name; + DeprecatedString name; }; struct MunmapData { @@ -212,11 +212,11 @@ public: struct ProcessCreateData { pid_t parent_pid { 0 }; - String executable; + DeprecatedString executable; }; struct ProcessExecData { - String executable; + DeprecatedString executable; }; struct ThreadCreateData { @@ -226,7 +226,7 @@ public: struct ReadData { int fd; size_t size; - String path; + DeprecatedString path; size_t start_timestamp; bool success; }; diff --git a/Userland/DevTools/Profiler/ProfileModel.cpp b/Userland/DevTools/Profiler/ProfileModel.cpp index e86868202a..338593f087 100644 --- a/Userland/DevTools/Profiler/ProfileModel.cpp +++ b/Userland/DevTools/Profiler/ProfileModel.cpp @@ -72,7 +72,7 @@ int ProfileModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String ProfileModel::column_name(int column) const +DeprecatedString ProfileModel::column_name(int column) const { switch (column) { case Column::SampleCount: @@ -117,7 +117,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol * 100.f / static_cast(m_profile.filtered_event_indices().size()) * percent_digits_rounding); - return String::formatted( + return DeprecatedString::formatted( "{}.{:02}", percentage_full_precision / percent_digits_rounding, percentage_full_precision % percent_digits_rounding); @@ -136,7 +136,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol return node->object_name(); if (index.column() == Column::StackFrame) { if (node->is_root()) { - return String::formatted("{} ({})", node->process().basename, node->process().pid); + return DeprecatedString::formatted("{} ({})", node->process().basename, node->process().pid); } return node->symbol(); } @@ -146,7 +146,7 @@ GUI::Variant ProfileModel::data(GUI::ModelIndex const& index, GUI::ModelRole rol auto const* library = node->process().library_metadata.library_containing(node->address()); if (!library) return ""; - return String::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base); + return DeprecatedString::formatted("{:p} (offset {:p})", node->address(), node->address() - library->base); } return {}; } diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 285e95f77f..cf4ce9d173 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -37,7 +37,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual GUI::ModelIndex index(int row, int column, GUI::ModelIndex const& parent = GUI::ModelIndex()) const override; virtual GUI::ModelIndex parent_index(GUI::ModelIndex const&) const override; diff --git a/Userland/DevTools/Profiler/SamplesModel.cpp b/Userland/DevTools/Profiler/SamplesModel.cpp index e6dd0f005a..405154604b 100644 --- a/Userland/DevTools/Profiler/SamplesModel.cpp +++ b/Userland/DevTools/Profiler/SamplesModel.cpp @@ -28,7 +28,7 @@ int SamplesModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SamplesModel::column_name(int column) const +DeprecatedString SamplesModel::column_name(int column) const { switch (column) { case Column::SampleIndex: diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h index 144307b5bf..06ab6c6ae8 100644 --- a/Userland/DevTools/Profiler/SamplesModel.h +++ b/Userland/DevTools/Profiler/SamplesModel.h @@ -36,7 +36,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SignpostsModel.cpp b/Userland/DevTools/Profiler/SignpostsModel.cpp index 237be28fb8..03737bb720 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.cpp +++ b/Userland/DevTools/Profiler/SignpostsModel.cpp @@ -26,7 +26,7 @@ int SignpostsModel::column_count(GUI::ModelIndex const&) const return Column::__Count; } -String SignpostsModel::column_name(int column) const +DeprecatedString SignpostsModel::column_name(int column) const { switch (column) { case Column::SignpostIndex: diff --git a/Userland/DevTools/Profiler/SignpostsModel.h b/Userland/DevTools/Profiler/SignpostsModel.h index f227f3a952..094c76b709 100644 --- a/Userland/DevTools/Profiler/SignpostsModel.h +++ b/Userland/DevTools/Profiler/SignpostsModel.h @@ -35,7 +35,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/SourceModel.cpp b/Userland/DevTools/Profiler/SourceModel.cpp index 29f374de65..ca478adc24 100644 --- a/Userland/DevTools/Profiler/SourceModel.cpp +++ b/Userland/DevTools/Profiler/SourceModel.cpp @@ -18,7 +18,7 @@ namespace Profiler { class SourceFile final { public: struct Line { - String content; + DeprecatedString content; size_t num_samples { 0 }; }; @@ -26,7 +26,7 @@ public: SourceFile(StringView filename) { - String source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly); + DeprecatedString source_file_name = filename.replace("../../"sv, source_root_path, ReplaceMode::FirstOnly); auto try_read_lines = [&]() -> ErrorOr { auto unbuffered_file = TRY(Core::Stream::File::open(source_file_name, Core::Stream::OpenMode::Read)); @@ -71,7 +71,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node) return; base_address = maybe_kernel_base.release_value(); if (g_kernel_debug_info == nullptr) - g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, String::empty(), base_address); + g_kernel_debug_info = make(g_kernel_debuginfo_object->elf, DeprecatedString::empty(), base_address); debug_info = g_kernel_debug_info.ptr(); } else { auto const& process = node.process(); @@ -87,7 +87,7 @@ SourceModel::SourceModel(Profile& profile, ProfileNode& node) VERIFY(debug_info != nullptr); // Try to read all source files contributing to the selected function and aggregate the samples by line. - HashMap source_files; + HashMap source_files; for (auto const& pair : node.events_per_address()) { auto position = debug_info->get_source_position(pair.key - base_address); if (position.has_value()) { @@ -123,7 +123,7 @@ int SourceModel::row_count(GUI::ModelIndex const&) const return m_source_lines.size(); } -String SourceModel::column_name(int column) const +DeprecatedString SourceModel::column_name(int column) const { switch (column) { case Column::SampleCount: diff --git a/Userland/DevTools/Profiler/SourceModel.h b/Userland/DevTools/Profiler/SourceModel.h index 9e2fa08f9f..0012f4e33a 100644 --- a/Userland/DevTools/Profiler/SourceModel.h +++ b/Userland/DevTools/Profiler/SourceModel.h @@ -16,9 +16,9 @@ class ProfileNode; struct SourceLineData { u32 event_count { 0 }; float percent { 0 }; - String location; + DeprecatedString location; u32 line_number { 0 }; - String source_code; + DeprecatedString source_code; }; class SourceModel final : public GUI::Model { @@ -38,7 +38,7 @@ public: virtual int row_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override; virtual int column_count(GUI::ModelIndex const& = GUI::ModelIndex()) const override { return Column::__Count; } - virtual String column_name(int) const override; + virtual DeprecatedString column_name(int) const override; virtual GUI::Variant data(GUI::ModelIndex const&, GUI::ModelRole) const override; virtual bool is_column_sortable(int) const override { return false; } diff --git a/Userland/DevTools/Profiler/TimelineHeader.cpp b/Userland/DevTools/Profiler/TimelineHeader.cpp index 9bdc51a511..4a4e99ab74 100644 --- a/Userland/DevTools/Profiler/TimelineHeader.cpp +++ b/Userland/DevTools/Profiler/TimelineHeader.cpp @@ -25,7 +25,7 @@ TimelineHeader::TimelineHeader(Profile& profile, Process const& process) update_selection(); m_icon = GUI::FileIconProvider::icon_for_executable(m_process.executable).bitmap_for_size(32); - m_text = String::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid); + m_text = DeprecatedString::formatted("{} ({})", LexicalPath::basename(m_process.executable), m_process.pid); } void TimelineHeader::paint_event(GUI::PaintEvent& event) diff --git a/Userland/DevTools/Profiler/TimelineHeader.h b/Userland/DevTools/Profiler/TimelineHeader.h index 6040b6d0aa..e484a1233a 100644 --- a/Userland/DevTools/Profiler/TimelineHeader.h +++ b/Userland/DevTools/Profiler/TimelineHeader.h @@ -33,7 +33,7 @@ private: Profile& m_profile; Process const& m_process; RefPtr m_icon; - String m_text; + DeprecatedString m_text; bool m_selected; }; diff --git a/Userland/DevTools/Profiler/TimelineTrack.cpp b/Userland/DevTools/Profiler/TimelineTrack.cpp index 4689a4d96d..8bd8ae5995 100644 --- a/Userland/DevTools/Profiler/TimelineTrack.cpp +++ b/Userland/DevTools/Profiler/TimelineTrack.cpp @@ -130,7 +130,7 @@ void TimelineTrack::mousemove_event(GUI::MouseEvent& event) Gfx::IntRect hoverable_rect { x - hoverable_padding, frame_thickness(), hoverable_padding * 2, height() - frame_thickness() * 2 }; if (hoverable_rect.contains_horizontally(event.x())) { auto const& data = signpost.data.template get(); - GUI::Application::the()->show_tooltip_immediately(String::formatted("{}, {}", data.string, data.arg), this); + GUI::Application::the()->show_tooltip_immediately(DeprecatedString::formatted("{}, {}", data.string, data.arg), this); hovering_a_signpost = true; return IterationDecision::Break; } diff --git a/Userland/DevTools/Profiler/main.cpp b/Userland/DevTools/Profiler/main.cpp index 2d3ed547d3..2c398582cb 100644 --- a/Userland/DevTools/Profiler/main.cpp +++ b/Userland/DevTools/Profiler/main.cpp @@ -60,18 +60,18 @@ ErrorOr serenity_main(Main::Arguments arguments) auto app = TRY(GUI::Application::try_create(arguments)); auto app_icon = TRY(GUI::Icon::try_create_default_icon("app-profiler"sv)); - String perfcore_file; + DeprecatedString perfcore_file; if (!perfcore_file_arg) { if (!generate_profile(pid)) return 0; - perfcore_file = String::formatted("/proc/{}/perf_events", pid); + perfcore_file = DeprecatedString::formatted("/proc/{}/perf_events", pid); } else { perfcore_file = perfcore_file_arg; } auto profile_or_error = Profile::load_from_perfcore_file(perfcore_file); if (profile_or_error.is_error()) { - GUI::MessageBox::show(nullptr, String::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, DeprecatedString::formatted("{}", profile_or_error.error()), "Profiler"sv, GUI::MessageBox::Type::Error); return 0; } @@ -223,11 +223,11 @@ ErrorOr serenity_main(Main::Arguments arguments) }; // FIXME: Make this constexpr once String is able to. - auto const sample_count_percent_format_string = String::formatted("{{:.{}f}}%", number_of_percent_digits); + auto const sample_count_percent_format_string = DeprecatedString::formatted("{{:.{}f}}%", number_of_percent_digits); auto const format_sample_count = [&profile, sample_count_percent_format_string](auto const sample_count) { if (profile->show_percentages()) - return String::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0)); - return String::formatted("{} Samples", sample_count.to_i32()); + return DeprecatedString::formatted(sample_count_percent_format_string, sample_count.as_float_or(0.0)); + return DeprecatedString::formatted("{} Samples", sample_count.to_i32()); }; auto statusbar = TRY(main_widget->try_add()); @@ -310,10 +310,10 @@ ErrorOr serenity_main(Main::Arguments arguments) return app->exec(); } -static bool prompt_to_stop_profiling(pid_t pid, String const& process_name) +static bool prompt_to_stop_profiling(pid_t pid, DeprecatedString const& process_name) { auto window = GUI::Window::construct(); - window->set_title(String::formatted("Profiling {}({})", process_name, pid)); + window->set_title(DeprecatedString::formatted("Profiling {}({})", process_name, pid)); window->resize(240, 100); window->set_icon(Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png"sv).release_value_but_fixme_should_propagate_errors()); window->center_on_screen(); @@ -327,7 +327,7 @@ static bool prompt_to_stop_profiling(pid_t pid, String const& process_name) Core::ElapsedTimer clock; clock.start(); auto update_timer = Core::Timer::construct(100, [&] { - timer_label.set_text(String::formatted("{:.1} seconds", clock.elapsed() / 1000.0f)); + timer_label.set_text(DeprecatedString::formatted("{:.1} seconds", clock.elapsed() / 1000.0f)); }); auto& stop_button = widget.add("Stop"); @@ -349,7 +349,7 @@ bool generate_profile(pid_t& pid) pid = process_chooser->pid(); } - String process_name; + DeprecatedString process_name; auto all_processes = Core::ProcessStatisticsReader::get_all(); if (all_processes.has_value()) { @@ -367,7 +367,7 @@ bool generate_profile(pid_t& pid) if (profiling_enable(pid, event_mask) < 0) { int saved_errno = errno; - GUI::MessageBox::show(nullptr, String::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error); + GUI::MessageBox::show(nullptr, DeprecatedString::formatted("Unable to profile process {}({}): {}", process_name, pid, strerror(saved_errno)), "Profiler"sv, GUI::MessageBox::Type::Error); return false; } -- cgit v1.2.3