mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:28:13 +00:00
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.)
This commit is contained in:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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; }
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue