1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:57:43 +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:
Andreas Kling 2021-04-23 16:46:57 +02:00
parent b3db01e20e
commit b91c49364d
228 changed files with 461 additions and 461 deletions

View file

@ -41,13 +41,13 @@ RefPtr<VMObject> AnonymousVMObject::clone()
// one would keep the one it still has. This ensures that the original
// one and this one, as well as the clone have sufficient resources
// to cow all pages as needed
m_shared_committed_cow_pages = adopt(*new CommittedCowPages(need_cow_pages));
m_shared_committed_cow_pages = adopt_ref(*new CommittedCowPages(need_cow_pages));
// Both original and clone become COW. So create a COW map for ourselves
// or reset all pages to be copied again if we were previously cloned
ensure_or_reset_cow_map();
return adopt(*new AnonymousVMObject(*this));
return adopt_ref(*new AnonymousVMObject(*this));
}
RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size, AllocationStrategy commit)
@ -57,17 +57,17 @@ RefPtr<AnonymousVMObject> AnonymousVMObject::create_with_size(size_t size, Alloc
if (!MM.commit_user_physical_pages(ceil_div(size, static_cast<size_t>(PAGE_SIZE))))
return {};
}
return adopt(*new AnonymousVMObject(size, commit));
return adopt_ref(*new AnonymousVMObject(size, commit));
}
NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_with_physical_pages(NonnullRefPtrVector<PhysicalPage> physical_pages)
{
return adopt(*new AnonymousVMObject(physical_pages));
return adopt_ref(*new AnonymousVMObject(physical_pages));
}
NonnullRefPtr<AnonymousVMObject> AnonymousVMObject::create_with_physical_page(PhysicalPage& page)
{
return adopt(*new AnonymousVMObject(page));
return adopt_ref(*new AnonymousVMObject(page));
}
RefPtr<AnonymousVMObject> AnonymousVMObject::create_for_physical_range(PhysicalAddress paddr, size_t size)
@ -76,7 +76,7 @@ RefPtr<AnonymousVMObject> AnonymousVMObject::create_for_physical_range(PhysicalA
dbgln("Shenanigans! create_for_physical_range({}, {}) would wrap around", paddr, size);
return nullptr;
}
return adopt(*new AnonymousVMObject(paddr, size));
return adopt_ref(*new AnonymousVMObject(paddr, size));
}
AnonymousVMObject::AnonymousVMObject(size_t size, AllocationStrategy strategy)

View file

@ -12,7 +12,7 @@ namespace Kernel {
NonnullRefPtr<ContiguousVMObject> ContiguousVMObject::create_with_size(size_t size, size_t physical_alignment)
{
return adopt(*new ContiguousVMObject(size, physical_alignment));
return adopt_ref(*new ContiguousVMObject(size, physical_alignment));
}
ContiguousVMObject::ContiguousVMObject(size_t size, size_t physical_alignment)

View file

@ -22,12 +22,12 @@ class PageDirectory : public RefCounted<PageDirectory> {
public:
static RefPtr<PageDirectory> create_for_userspace(const RangeAllocator* parent_range_allocator = nullptr)
{
auto page_directory = adopt(*new PageDirectory(parent_range_allocator));
auto page_directory = adopt_ref(*new PageDirectory(parent_range_allocator));
if (!page_directory->is_valid())
return {};
return page_directory;
}
static NonnullRefPtr<PageDirectory> create_kernel_page_directory() { return adopt(*new PageDirectory); }
static NonnullRefPtr<PageDirectory> create_kernel_page_directory() { return adopt_ref(*new PageDirectory); }
static RefPtr<PageDirectory> find_by_cr3(u32);
~PageDirectory();

View file

@ -12,7 +12,7 @@ namespace Kernel {
NonnullRefPtr<PhysicalPage> PhysicalPage::create(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist)
{
return adopt(*new PhysicalPage(paddr, supervisor, may_return_to_freelist));
return adopt_ref(*new PhysicalPage(paddr, supervisor, may_return_to_freelist));
}
PhysicalPage::PhysicalPage(PhysicalAddress paddr, bool supervisor, bool may_return_to_freelist)

View file

@ -17,7 +17,7 @@ namespace Kernel {
NonnullRefPtr<PhysicalRegion> PhysicalRegion::create(PhysicalAddress lower, PhysicalAddress upper)
{
return adopt(*new PhysicalRegion(lower, upper));
return adopt_ref(*new PhysicalRegion(lower, upper));
}
PhysicalRegion::PhysicalRegion(PhysicalAddress lower, PhysicalAddress upper)

View file

@ -11,12 +11,12 @@ namespace Kernel {
NonnullRefPtr<PrivateInodeVMObject> PrivateInodeVMObject::create_with_inode(Inode& inode)
{
return adopt(*new PrivateInodeVMObject(inode, inode.size()));
return adopt_ref(*new PrivateInodeVMObject(inode, inode.size()));
}
RefPtr<VMObject> PrivateInodeVMObject::clone()
{
return adopt(*new PrivateInodeVMObject(*this));
return adopt_ref(*new PrivateInodeVMObject(*this));
}
PrivateInodeVMObject::PrivateInodeVMObject(Inode& inode, size_t size)

View file

@ -14,14 +14,14 @@ NonnullRefPtr<SharedInodeVMObject> SharedInodeVMObject::create_with_inode(Inode&
size_t size = inode.size();
if (auto shared_vmobject = inode.shared_vmobject())
return shared_vmobject.release_nonnull();
auto vmobject = adopt(*new SharedInodeVMObject(inode, size));
auto vmobject = adopt_ref(*new SharedInodeVMObject(inode, size));
vmobject->inode().set_shared_vmobject(*vmobject);
return vmobject;
}
RefPtr<VMObject> SharedInodeVMObject::clone()
{
return adopt(*new SharedInodeVMObject(*this));
return adopt_ref(*new SharedInodeVMObject(*this));
}
SharedInodeVMObject::SharedInodeVMObject(Inode& inode, size_t size)