mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 14:58:46 +00:00
Kernel: Use RefPtr instead of LockRefPtr for PhysicalPage
I believe this to be safe, as the main thing that LockRefPtr provides over RefPtr is safe copying from a shared LockRefPtr instance. I've inspected the uses of RefPtr<PhysicalPage> and it seems they're all guarded by external locking. Some of it is less obvious, but this is an area where we're making continuous headway.
This commit is contained in:
parent
5a804b9a1d
commit
2c72d495a3
Notes:
sideshowbarker
2024-07-17 07:48:28 +09:00
Author: https://github.com/awesomekling
Commit: 2c72d495a3
33 changed files with 141 additions and 138 deletions
|
@ -56,21 +56,21 @@ ErrorOr<void> SharedFramebufferVMObject::create_real_writes_framebuffer_vm_objec
|
|||
return {};
|
||||
}
|
||||
|
||||
Span<LockRefPtr<PhysicalPage>> SharedFramebufferVMObject::real_framebuffer_physical_pages()
|
||||
Span<RefPtr<PhysicalPage>> SharedFramebufferVMObject::real_framebuffer_physical_pages()
|
||||
{
|
||||
return m_real_framebuffer_vmobject->physical_pages();
|
||||
}
|
||||
Span<LockRefPtr<PhysicalPage> const> SharedFramebufferVMObject::real_framebuffer_physical_pages() const
|
||||
Span<RefPtr<PhysicalPage> const> SharedFramebufferVMObject::real_framebuffer_physical_pages() const
|
||||
{
|
||||
return m_real_framebuffer_vmobject->physical_pages();
|
||||
}
|
||||
|
||||
Span<LockRefPtr<PhysicalPage>> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages()
|
||||
Span<RefPtr<PhysicalPage>> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages()
|
||||
{
|
||||
return m_physical_pages.span();
|
||||
}
|
||||
|
||||
Span<LockRefPtr<PhysicalPage> const> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() const
|
||||
Span<RefPtr<PhysicalPage> const> SharedFramebufferVMObject::fake_sink_framebuffer_physical_pages() const
|
||||
{
|
||||
return m_physical_pages.span();
|
||||
}
|
||||
|
@ -92,14 +92,14 @@ void SharedFramebufferVMObject::switch_to_real_framebuffer_writes(Badge<Kernel::
|
|||
});
|
||||
}
|
||||
|
||||
Span<LockRefPtr<PhysicalPage> const> SharedFramebufferVMObject::physical_pages() const
|
||||
Span<RefPtr<PhysicalPage> const> SharedFramebufferVMObject::physical_pages() const
|
||||
{
|
||||
SpinlockLocker locker(m_writes_state_lock);
|
||||
if (m_writes_are_faked)
|
||||
return VMObject::physical_pages();
|
||||
return m_real_framebuffer_vmobject->physical_pages();
|
||||
}
|
||||
Span<LockRefPtr<PhysicalPage>> SharedFramebufferVMObject::physical_pages()
|
||||
Span<RefPtr<PhysicalPage>> SharedFramebufferVMObject::physical_pages()
|
||||
{
|
||||
SpinlockLocker locker(m_writes_state_lock);
|
||||
if (m_writes_are_faked)
|
||||
|
@ -107,7 +107,7 @@ Span<LockRefPtr<PhysicalPage>> SharedFramebufferVMObject::physical_pages()
|
|||
return m_real_framebuffer_vmobject->physical_pages();
|
||||
}
|
||||
|
||||
SharedFramebufferVMObject::SharedFramebufferVMObject(FixedArray<LockRefPtr<PhysicalPage>>&& new_physical_pages, CommittedPhysicalPageSet committed_pages, AnonymousVMObject& real_framebuffer_vmobject)
|
||||
SharedFramebufferVMObject::SharedFramebufferVMObject(FixedArray<RefPtr<PhysicalPage>>&& new_physical_pages, CommittedPhysicalPageSet committed_pages, AnonymousVMObject& real_framebuffer_vmobject)
|
||||
: VMObject(move(new_physical_pages))
|
||||
, m_real_framebuffer_vmobject(real_framebuffer_vmobject)
|
||||
, m_committed_pages(move(committed_pages))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue