summaryrefslogtreecommitdiff
path: root/Kernel/Library
diff options
context:
space:
mode:
authorLenny Maiorani <lenny@serenityos.org>2022-12-15 20:51:55 -0700
committerTim Flynn <trflynn89@pm.me>2022-12-17 16:00:08 -0500
commitf2336d0144fbbf6d72bd1eeaa34667dc4eb76760 (patch)
treea1f1c53b9257a11baf2f2e382ddf2f6bd9b2c27e /Kernel/Library
parent53133b4359caf5a8cc5f30d1313759ea4a017870 (diff)
downloadserenity-f2336d0144fbbf6d72bd1eeaa34667dc4eb76760.zip
AK+Everywhere: Move custom deleter capability to OwnPtr
`OwnPtrWithCustomDeleter` was a decorator which provided the ability to add a custom deleter to `OwnPtr` by wrapping and taking the deleter as a run-time argument to the constructor. This solution means that no additional space is needed for the `OwnPtr` because it doesn't need to store a pointer to the deleter, but comes at the cost of having an extra type that stores a pointer for every instance. This logic is moved directly into `OwnPtr` by adding a template argument that is defaulted to the default deleter for the type. This means that the type itself stores the pointer to the deleter instead of every instance and adds some type safety by encoding the deleter in the type itself instead of taking a run-time argument.
Diffstat (limited to 'Kernel/Library')
-rw-r--r--Kernel/Library/LockRefPtr.h3
-rw-r--r--Kernel/Library/NonnullLockRefPtr.h2
2 files changed, 0 insertions, 5 deletions
diff --git a/Kernel/Library/LockRefPtr.h b/Kernel/Library/LockRefPtr.h
index 4c7aeb70f3..a124ef3d31 100644
--- a/Kernel/Library/LockRefPtr.h
+++ b/Kernel/Library/LockRefPtr.h
@@ -24,9 +24,6 @@
namespace AK {
template<typename T>
-class OwnPtr;
-
-template<typename T>
struct LockRefPtrTraits {
ALWAYS_INLINE static T* as_ptr(FlatPtr bits)
{
diff --git a/Kernel/Library/NonnullLockRefPtr.h b/Kernel/Library/NonnullLockRefPtr.h
index 97140bb619..6b6039a9a9 100644
--- a/Kernel/Library/NonnullLockRefPtr.h
+++ b/Kernel/Library/NonnullLockRefPtr.h
@@ -21,8 +21,6 @@
namespace AK {
-template<typename T>
-class OwnPtr;
template<typename T, typename PtrTraits>
class LockRefPtr;