diff options
author | Andreas Kling <kling@serenityos.org> | 2021-04-23 16:46:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-23 16:46:57 +0200 |
commit | b91c49364df1683c7fe1191eb02b8d9c331874f6 (patch) | |
tree | a9ea5ff8e4cc8cfcfe75c279551be35793d0ffb3 /Userland/DevTools | |
parent | b3db01e20eeae632cc75df9af8666772bda67091 (diff) | |
download | serenity-b91c49364df1683c7fe1191eb02b8d9c331874f6.zip |
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
Diffstat (limited to 'Userland/DevTools')
22 files changed, 26 insertions, 26 deletions
diff --git a/Userland/DevTools/HackStudio/ClassViewWidget.cpp b/Userland/DevTools/HackStudio/ClassViewWidget.cpp index 820da3cb08..4f05ac67f6 100644 --- a/Userland/DevTools/HackStudio/ClassViewWidget.cpp +++ b/Userland/DevTools/HackStudio/ClassViewWidget.cpp @@ -33,7 +33,7 @@ ClassViewWidget::ClassViewWidget() RefPtr<ClassViewModel> ClassViewModel::create() { - return adopt(*new ClassViewModel()); + return adopt_ref(*new ClassViewModel()); } int ClassViewModel::row_count(const GUI::ModelIndex& index) const diff --git a/Userland/DevTools/HackStudio/CodeDocument.cpp b/Userland/DevTools/HackStudio/CodeDocument.cpp index 43078fe205..bc08806b59 100644 --- a/Userland/DevTools/HackStudio/CodeDocument.cpp +++ b/Userland/DevTools/HackStudio/CodeDocument.cpp @@ -10,12 +10,12 @@ namespace HackStudio { NonnullRefPtr<CodeDocument> CodeDocument::create(const String& file_path, Client* client) { - return adopt(*new CodeDocument(file_path, client)); + return adopt_ref(*new CodeDocument(file_path, client)); } NonnullRefPtr<CodeDocument> CodeDocument::create(Client* client) { - return adopt(*new CodeDocument(client)); + return adopt_ref(*new CodeDocument(client)); } CodeDocument::CodeDocument(const String& file_path, Client* client) diff --git a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp index 03b103929d..4cc245ee92 100644 --- a/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/BacktraceModel.cpp @@ -12,7 +12,7 @@ namespace HackStudio { NonnullRefPtr<BacktraceModel> BacktraceModel::create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs) { - return adopt(*new BacktraceModel(create_backtrace(debug_session, regs))); + return adopt_ref(*new BacktraceModel(create_backtrace(debug_session, regs))); } GUI::Variant BacktraceModel::data(const GUI::ModelIndex& index, GUI::ModelRole role) const diff --git a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h index 870ccd853e..ba856bcb6c 100644 --- a/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h +++ b/Userland/DevTools/HackStudio/Debugger/DisassemblyModel.h @@ -30,7 +30,7 @@ class DisassemblyModel final : public GUI::Model { public: static NonnullRefPtr<DisassemblyModel> create(const Debug::DebugSession& debug_session, const PtraceRegisters& regs) { - return adopt(*new DisassemblyModel(debug_session, regs)); + return adopt_ref(*new DisassemblyModel(debug_session, regs)); } enum Column { diff --git a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h index e540391234..cc984f86f2 100644 --- a/Userland/DevTools/HackStudio/Debugger/RegistersModel.h +++ b/Userland/DevTools/HackStudio/Debugger/RegistersModel.h @@ -22,12 +22,12 @@ class RegistersModel final : public GUI::Model { public: static RefPtr<RegistersModel> create(const PtraceRegisters& regs) { - return adopt(*new RegistersModel(regs)); + return adopt_ref(*new RegistersModel(regs)); } static RefPtr<RegistersModel> create(const PtraceRegisters& current_regs, const PtraceRegisters& previous_regs) { - return adopt(*new RegistersModel(current_regs, previous_regs)); + return adopt_ref(*new RegistersModel(current_regs, previous_regs)); } enum Column { diff --git a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp index c5a8d17188..40749baed9 100644 --- a/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp +++ b/Userland/DevTools/HackStudio/Debugger/VariablesModel.cpp @@ -169,7 +169,7 @@ RefPtr<VariablesModel> VariablesModel::create(const PtraceRegisters& regs) if (!lib) return nullptr; auto variables = lib->debug_info->get_variables_in_current_scope(regs); - return adopt(*new VariablesModel(move(variables), regs)); + return adopt_ref(*new VariablesModel(move(variables), regs)); } } diff --git a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h index c52f2db1b1..4674a738cf 100644 --- a/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h +++ b/Userland/DevTools/HackStudio/Dialogs/ProjectTemplatesModel.h @@ -19,7 +19,7 @@ class ProjectTemplatesModel final : public GUI::Model { public: static NonnullRefPtr<ProjectTemplatesModel> create() { - return adopt(*new ProjectTemplatesModel()); + return adopt_ref(*new ProjectTemplatesModel()); } enum Column { diff --git a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp index a82a9c0c3d..7bc50f0da8 100644 --- a/Userland/DevTools/HackStudio/FindInFilesWidget.cpp +++ b/Userland/DevTools/HackStudio/FindInFilesWidget.cpp @@ -110,7 +110,7 @@ static RefPtr<SearchResultsModel> find_in_files(const StringView& text) } }); - return adopt(*new SearchResultsModel(move(matches))); + return adopt_ref(*new SearchResultsModel(move(matches))); } FindInFilesWidget::FindInFilesWidget() diff --git a/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp b/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp index 89b24e4691..99cb8a6f4e 100644 --- a/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp +++ b/Userland/DevTools/HackStudio/Git/GitFilesModel.cpp @@ -10,7 +10,7 @@ namespace HackStudio { NonnullRefPtr<GitFilesModel> GitFilesModel::create(Vector<LexicalPath>&& files) { - return adopt(*new GitFilesModel(move(files))); + return adopt_ref(*new GitFilesModel(move(files))); } GitFilesModel::GitFilesModel(Vector<LexicalPath>&& files) diff --git a/Userland/DevTools/HackStudio/Git/GitRepo.cpp b/Userland/DevTools/HackStudio/Git/GitRepo.cpp index 50506fd13a..f42f832994 100644 --- a/Userland/DevTools/HackStudio/Git/GitRepo.cpp +++ b/Userland/DevTools/HackStudio/Git/GitRepo.cpp @@ -20,7 +20,7 @@ GitRepo::CreateResult GitRepo::try_to_create(const LexicalPath& repository_root) return { CreateResult::Type::NoGitRepo, nullptr }; } - return { CreateResult::Type::Success, adopt(*new GitRepo(repository_root)) }; + return { CreateResult::Type::Success, adopt_ref(*new GitRepo(repository_root)) }; } RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_root) @@ -30,7 +30,7 @@ RefPtr<GitRepo> GitRepo::initialize_repository(const LexicalPath& repository_roo return {}; VERIFY(git_repo_exists(repository_root)); - return adopt(*new GitRepo(repository_root)); + return adopt_ref(*new GitRepo(repository_root)); } Vector<LexicalPath> GitRepo::unstaged_files() const diff --git a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp index ee608fba20..0dc64cb6a3 100644 --- a/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp +++ b/Userland/DevTools/HackStudio/LanguageServers/FileDB.cpp @@ -26,7 +26,7 @@ RefPtr<GUI::TextDocument> FileDB::get(const String& file_name) auto document = reinterpret_cast<const FileDB*>(this)->get(file_name); if (document.is_null()) return nullptr; - return adopt(*const_cast<GUI::TextDocument*>(document.leak_ref())); + return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref())); } RefPtr<const GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& file_name) const @@ -43,7 +43,7 @@ RefPtr<GUI::TextDocument> FileDB::get_or_create_from_filesystem(const String& fi auto document = reinterpret_cast<const FileDB*>(this)->get_or_create_from_filesystem(file_name); if (document.is_null()) return nullptr; - return adopt(*const_cast<GUI::TextDocument*>(document.leak_ref())); + return adopt_ref(*const_cast<GUI::TextDocument*>(document.leak_ref())); } bool FileDB::is_open(const String& file_name) const diff --git a/Userland/DevTools/HackStudio/Locator.cpp b/Userland/DevTools/HackStudio/Locator.cpp index 3d24bca48a..44eba20f23 100644 --- a/Userland/DevTools/HackStudio/Locator.cpp +++ b/Userland/DevTools/HackStudio/Locator.cpp @@ -211,7 +211,7 @@ void Locator::update_suggestions() bool has_suggestions = !suggestions.is_empty(); - m_suggestion_view->set_model(adopt(*new LocatorSuggestionModel(move(suggestions)))); + m_suggestion_view->set_model(adopt_ref(*new LocatorSuggestionModel(move(suggestions)))); if (!has_suggestions) m_suggestion_view->selection().clear(); diff --git a/Userland/DevTools/HackStudio/ProjectFile.h b/Userland/DevTools/HackStudio/ProjectFile.h index c44362e8b0..72fc3e7a24 100644 --- a/Userland/DevTools/HackStudio/ProjectFile.h +++ b/Userland/DevTools/HackStudio/ProjectFile.h @@ -18,7 +18,7 @@ class ProjectFile : public RefCounted<ProjectFile> { public: static NonnullRefPtr<ProjectFile> construct_with_name(const String& name) { - return adopt(*new ProjectFile(name)); + return adopt_ref(*new ProjectFile(name)); } const String& name() const { return m_name; } diff --git a/Userland/DevTools/HackStudio/ProjectTemplate.cpp b/Userland/DevTools/HackStudio/ProjectTemplate.cpp index 84e8b95d0b..8c0f6c3f82 100644 --- a/Userland/DevTools/HackStudio/ProjectTemplate.cpp +++ b/Userland/DevTools/HackStudio/ProjectTemplate.cpp @@ -62,7 +62,7 @@ RefPtr<ProjectTemplate> ProjectTemplate::load_from_manifest(const String& manife icon = GUI::Icon(move(bitmap32)); } - return adopt(*new ProjectTemplate(id, name, description, icon, priority)); + return adopt_ref(*new ProjectTemplate(id, name, description, icon, priority)); } Result<void, String> ProjectTemplate::create_project(const String& name, const String& path) diff --git a/Userland/DevTools/HackStudio/WidgetTreeModel.h b/Userland/DevTools/HackStudio/WidgetTreeModel.h index f487aacf3e..c8dacf9e54 100644 --- a/Userland/DevTools/HackStudio/WidgetTreeModel.h +++ b/Userland/DevTools/HackStudio/WidgetTreeModel.h @@ -13,7 +13,7 @@ namespace HackStudio { class WidgetTreeModel final : public GUI::Model { public: - static NonnullRefPtr<WidgetTreeModel> create(GUI::Widget& root) { return adopt(*new WidgetTreeModel(root)); } + static NonnullRefPtr<WidgetTreeModel> create(GUI::Widget& root) { return adopt_ref(*new WidgetTreeModel(root)); } virtual ~WidgetTreeModel() override; virtual int row_count(const GUI::ModelIndex& = GUI::ModelIndex()) const override; diff --git a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h index ae8986e753..dd2aec7948 100644 --- a/Userland/DevTools/Inspector/RemoteObjectGraphModel.h +++ b/Userland/DevTools/Inspector/RemoteObjectGraphModel.h @@ -20,7 +20,7 @@ class RemoteObjectGraphModel final : public GUI::Model { public: static NonnullRefPtr<RemoteObjectGraphModel> create(RemoteProcess& process) { - return adopt(*new RemoteObjectGraphModel(process)); + return adopt_ref(*new RemoteObjectGraphModel(process)); } virtual ~RemoteObjectGraphModel() override; diff --git a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h index d8f1d26352..fca20109fe 100644 --- a/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h +++ b/Userland/DevTools/Inspector/RemoteObjectPropertyModel.h @@ -20,7 +20,7 @@ public: virtual ~RemoteObjectPropertyModel() override { } static NonnullRefPtr<RemoteObjectPropertyModel> create(RemoteObject& object) { - return adopt(*new RemoteObjectPropertyModel(object)); + return adopt_ref(*new RemoteObjectPropertyModel(object)); } enum Column { diff --git a/Userland/DevTools/Profiler/DisassemblyModel.h b/Userland/DevTools/Profiler/DisassemblyModel.h index 961570a0c9..382c384fde 100644 --- a/Userland/DevTools/Profiler/DisassemblyModel.h +++ b/Userland/DevTools/Profiler/DisassemblyModel.h @@ -25,7 +25,7 @@ class DisassemblyModel final : public GUI::Model { public: static NonnullRefPtr<DisassemblyModel> create(Profile& profile, ProfileNode& node) { - return adopt(*new DisassemblyModel(profile, node)); + return adopt_ref(*new DisassemblyModel(profile, node)); } enum Column { diff --git a/Userland/DevTools/Profiler/IndividualSampleModel.h b/Userland/DevTools/Profiler/IndividualSampleModel.h index cdd7008967..7ff5dacd73 100644 --- a/Userland/DevTools/Profiler/IndividualSampleModel.h +++ b/Userland/DevTools/Profiler/IndividualSampleModel.h @@ -14,7 +14,7 @@ class IndividualSampleModel final : public GUI::Model { public: static NonnullRefPtr<IndividualSampleModel> create(Profile& profile, size_t event_index) { - return adopt(*new IndividualSampleModel(profile, event_index)); + return adopt_ref(*new IndividualSampleModel(profile, event_index)); } enum Column { diff --git a/Userland/DevTools/Profiler/Profile.h b/Userland/DevTools/Profiler/Profile.h index 54e5c34bc9..659d0b6d12 100644 --- a/Userland/DevTools/Profiler/Profile.h +++ b/Userland/DevTools/Profiler/Profile.h @@ -71,7 +71,7 @@ class ProfileNode : public RefCounted<ProfileNode> { public: static NonnullRefPtr<ProfileNode> create(FlyString object_name, String symbol, u32 address, u32 offset, u64 timestamp, pid_t pid) { - return adopt(*new ProfileNode(move(object_name), move(symbol), address, offset, timestamp, pid)); + return adopt_ref(*new ProfileNode(move(object_name), move(symbol), address, offset, timestamp, pid)); } // These functions are only relevant for root nodes diff --git a/Userland/DevTools/Profiler/ProfileModel.h b/Userland/DevTools/Profiler/ProfileModel.h index 21ebbc837e..b9612c2894 100644 --- a/Userland/DevTools/Profiler/ProfileModel.h +++ b/Userland/DevTools/Profiler/ProfileModel.h @@ -14,7 +14,7 @@ class ProfileModel final : public GUI::Model { public: static NonnullRefPtr<ProfileModel> create(Profile& profile) { - return adopt(*new ProfileModel(profile)); + return adopt_ref(*new ProfileModel(profile)); } enum Column { diff --git a/Userland/DevTools/Profiler/SamplesModel.h b/Userland/DevTools/Profiler/SamplesModel.h index d3ef72556e..9ebf18c049 100644 --- a/Userland/DevTools/Profiler/SamplesModel.h +++ b/Userland/DevTools/Profiler/SamplesModel.h @@ -14,7 +14,7 @@ class SamplesModel final : public GUI::Model { public: static NonnullRefPtr<SamplesModel> create(Profile& profile) { - return adopt(*new SamplesModel(profile)); + return adopt_ref(*new SamplesModel(profile)); } enum Column { |