ladybird/AK
Andreas Kling c9a35e104b AK: Add RefCountForwarder<T>
This is a convenience template that implements reference count
forwarding. This means that an object forwards ref() and unref() to
another object.

We can use this when two ref-counted objects need to keep each other
alive. This situation poses two problems:

- Using 2x RefPtr would cause a ref cycle and leak both objects.
- Using 2x WeakPtr would allow one of them to be destroyed early.

With RefCountForwarder, only one of the objects has a ref count. The
object with the ref count points to the forwarding object by using a
non-counting smart pointer (OwnPtr or NonnullOwnPtr). Thus, both objects
are kept alive by the same ref count, and they can safely point to each
other without worrying about disjoint lifetimes.
2021-12-09 21:28:52 +01:00
..
.clang-tidy Meta: Add basic clang-tidy configuration 2021-11-14 22:52:35 +01:00
AllOf.h AK: Reimplement all_of in terms of find_if 2021-07-24 13:11:13 +04:30
AnyOf.h AK: Implement any_of using common implementation 2021-08-06 23:57:48 +02:00
Array.h AK: Stop publishing detail namespaced functions 2021-08-15 15:14:19 +02:00
Assertions.h AK: Suppress false-positive clang-tidy warning in Assertions.h 2021-11-14 22:52:35 +01:00
Atomic.h AK: Resolve clang-tidy warnings about unusual assignment operators 2021-11-14 22:52:35 +01:00
Badge.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Base64.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Base64.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
BinaryBufferWriter.h AK: Add helper type for serializing structures into buffer 2021-07-18 19:58:17 +04:30
BinaryHeap.h AK: Add missing headers 2021-10-06 23:52:40 +01:00
BinarySearch.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
BitCast.h AK: Use __builtin_bit_cast if available 2021-08-21 13:48:59 +04:30
Bitmap.h AK: Remove unused static member of Bitmap 2021-11-28 13:16:41 -08:00
BitmapView.h AK: Resolve clang-tidy readability-bool-conversion warnings 2021-11-14 22:52:35 +01:00
BitStream.h AK: Add big endian bit reading to InputBitStream 2021-06-25 20:48:14 +04:30
Buffered.h AK: Expose Buffered's buffer size and underlying stream 2021-11-28 13:33:51 -08:00
BumpAllocator.h AK: Make BumpAllocator work in multi-threaded environments 2021-10-31 18:43:03 +01:00
ByteBuffer.h AK: Resolve clang-tidy readability-qualified-auto warnings 2021-11-14 22:52:35 +01:00
ByteReader.h AK: Generalize ByteReader 2021-07-14 11:26:34 +04:30
CharacterTypes.h AK: Add the to_ascii_base36_digit helper method 2021-06-29 16:55:54 +01:00
Checked.h AK: Resolve clang-tidy warnings about unusual assignment operators 2021-11-14 22:52:35 +01:00
CheckedFormatString.h AK: Don't define ENABLE_COMPILETIME_FORMAT_CHECK when parsed by CLion 2021-11-08 00:35:27 +01:00
CircularDeque.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
CircularDuplexStream.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
CircularQueue.h AK: Resolve clang-tidy readability-bool-conversion warnings 2021-11-14 22:52:35 +01:00
CMakeLists.txt Meta: Add support for declaring components 2021-06-17 11:03:51 +02:00
Complex.h Everywhere: Use AK/Math.h if applicable 2021-07-19 16:34:21 +04:30
Concepts.h AK: Add a concept for iterable containers 2021-07-22 22:56:20 +02:00
DateTimeLexer.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Debug.h.in LibWasm: Implement module validation 2021-11-11 09:20:04 +01:00
Demangle.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
DisjointChunks.h AK: Add an abstraction over multiple disjoint buffers 2021-09-14 21:33:15 +04:30
DistinctNumeric.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
DoublyLinkedList.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Endian.h AK: Add formatters for BigEndian and LittleEndian 2021-08-02 00:25:11 +02:00
EnumBits.h AK+Kernel: Implement and use EnumBits has_any_flag() 2021-07-16 11:49:50 +02:00
Error.h AK: Implement missing const getters in AK::Error, fix typo 2021-12-05 22:59:09 +01:00
ExtraMathConstants.h Userland: Move non-standard math constants from math.h 2021-04-27 23:06:16 +02:00
FileStream.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Find.h AK: Rewrite {AnyOf,AllOf,Find}.h to use the IteratorPairWith concept 2021-07-22 22:56:20 +02:00
FixedArray.h AK: Use default constructor/destructor instead of declaring an empty one 2021-09-16 17:17:13 +02:00
FixedPoint.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
FlyString.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
FlyString.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Format.cpp Kernel: Wrap format timespec assignment in a check for !AARCH64 2021-11-21 09:12:16 +01:00
Format.h AK: Implement Formatter for ErrorOr<> 2021-12-05 22:59:09 +01:00
Forward.h AK: Forward declare Error and ErrorOr in AK/Forward.h 2021-11-17 00:21:12 +01:00
Function.h AK: Suppress false positive readability-non-const-parameter in Function 2021-11-14 22:52:35 +01:00
GenericLexer.cpp AK: Add GenericLexer API to consume an escaped Unicode code point 2021-08-19 23:49:25 +02:00
GenericLexer.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
HashFunctions.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
HashMap.h AK: Allow to clear HashTables/Maps with capacity 2021-11-11 09:19:17 +01:00
HashTable.h AK: Resolve clang-tidy readability-qualified-auto warnings 2021-11-14 22:52:35 +01:00
Hex.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Hex.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
IDAllocator.h AK: Use get_random() in IDAllocator 2021-08-30 18:35:36 +02:00
IntrusiveDetails.h AK: Add missing headers 2021-10-06 23:52:40 +01:00
IntrusiveList.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
IntrusiveListRelaxedConst.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
IntrusiveRedBlackTree.h AK+Kernel: Reduce the number of template parameters of IntrusiveRBTree 2021-09-10 18:05:46 +03:00
IPv4Address.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
IterationDecision.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Iterator.h AK: Make Vector capable of holding reference types 2021-06-08 19:14:24 +02:00
JsonArray.h AK: Use [[nodiscard]] in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
JsonArraySerializer.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
JsonObject.h AK: Use [[nodiscard]] in JsonObject and JsonArray 2021-06-29 13:18:03 +02:00
JsonObjectSerializer.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
JsonParser.cpp AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional) 2021-11-17 00:21:10 +01:00
JsonParser.h AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional) 2021-11-17 00:21:10 +01:00
JsonPath.cpp Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
JsonPath.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
JsonValue.cpp AK: Make JSON parser return ErrorOr<JsonValue> (instead of Optional) 2021-11-17 00:21:10 +01:00
JsonValue.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
kmalloc.cpp AK: Declare operators new and delete as global functions 2021-07-05 20:23:42 +02:00
kmalloc.h AK: Add operator delete stub to all AK_MAKE_ETERNAL objects 2021-08-30 16:44:16 +02:00
kstdio.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
LEB128.h AK: Don't perform the shift when it's too large when decoding LEB128 2021-08-31 16:37:49 +02:00
LexicalPath.cpp AK: Add LexicalPath::prepend() 2021-11-22 09:03:47 +01:00
LexicalPath.h AK: Add LexicalPath::prepend() 2021-11-22 09:03:47 +01:00
MACAddress.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Math.h AK: Implement acos<T> correctly 2021-11-18 21:10:30 +01:00
MemMem.h AK: Mark MemMem header-only functions as inline rather than static 2021-11-22 05:23:24 +03:30
Memory.h AK: Add secure_zero() implementation so it can be used on all platforms 2021-09-13 00:02:42 +02:00
MemoryStream.h Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
NeverDestroyed.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Noncopyable.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NonnullOwnPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
NonnullOwnPtrVector.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
NonnullPtrVector.h AK: Use default constructor/destructor instead of declaring an empty one 2021-09-16 17:17:13 +02:00
NonnullRefPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
NonnullRefPtrVector.h AK: Make NonnullRefPtrVector constructible from Vector<NonnullRefPtr> 2021-06-11 00:30:09 +02:00
NumberFormat.h Everywhere: Use "the SerenityOS developers." in copyright headers 2021-04-29 00:59:26 +02:00
NumericLimits.h AK: Use proper type for bool NumericLimits::min and max specialization 2021-11-14 22:52:35 +01:00
Optional.h AK: Always inline Optional::release_value() 2021-10-25 14:31:46 +02:00
OwnPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
Platform.h Kernel: Add VALIDATE_IS_X86 macro 2021-12-01 11:22:04 -08:00
PrintfImplementation.h AK: Zero-pad automatically if formatting with precision 2021-12-07 20:13:59 -08:00
Ptr32.h AK: Fix building Ptr32 on x86_64 2021-06-24 09:27:13 +02:00
Queue.h AK+Everywhere: Reduce the number of template parameters of IntrusiveList 2021-09-10 18:05:46 +03:00
QuickSort.h AK: Guarantee a maximum stack depth for dual_pivot_quick_sort 2021-04-28 21:38:48 +02:00
Random.cpp AK: Introduce get_random_uniform() 2021-05-14 22:24:02 +02:00
Random.h AK+LibCore: Standardize on AK_OS_MACOS instead of __APPLE__ 2021-09-12 18:31:10 +02:00
RecursionDecision.h AK: Add RecursionDecision 2021-08-07 15:21:58 +02:00
RedBlackTree.h AK: Make RedBlackTree::try_insert() return ErrorOr<void> instead of bool 2021-11-18 21:11:30 +01:00
RefCounted.h AK+Kernel: Suppress clang-tidy warnings from the cert-* category 2021-11-14 22:52:35 +01:00
RefCountForwarder.h AK: Add RefCountForwarder<T> 2021-12-09 21:28:52 +01:00
RefPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00
Result.h AK: Allow to "get a result" from Result<void> 2021-11-28 13:33:51 -08:00
ScopedValueRollback.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ScopeGuard.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
ScopeLogger.h AK: Store the 'extra' field of ScopeLogger as String 2021-06-29 00:07:19 +04:30
SIMD.h AK: Add char SIMD types 2021-07-22 23:33:21 +02:00
Singleton.h Kernel: Split ScopedCritical so header is platform independent 2021-10-15 21:48:45 +01:00
SinglyLinkedList.h AK: Make SinglyLinkedList::remove() public 2021-08-31 17:03:55 +04:30
SinglyLinkedListWithCount.h Everywhere: Use bgianf@serenityos.org for my copyright attribution 2021-04-22 21:15:54 +02:00
SourceGenerator.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
SourceLocation.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
Span.h AK: Make Span trivially copy-constructible 2021-10-17 17:09:58 +01:00
Stack.h AK: Implement AK::Stack 2021-05-26 16:36:53 +04:30
StackInfo.cpp AK+LibCore: Standardize on AK_OS_MACOS instead of __APPLE__ 2021-09-12 18:31:10 +02:00
StackInfo.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Statistics.h AK: Add min and max functions to Statistics 2021-11-06 22:09:25 -07:00
StdLibExtraDetails.h AK: Add IsPOD<T> template to StdLibExtras 2021-10-21 09:02:23 +01:00
StdLibExtras.h AK+Kernel: Suppress clang-tidy warnings from the cert-* category 2021-11-14 22:52:35 +01:00
Stream.h LibIPC+IPCCompiler+AK: Make IPC value decoders return ErrorOr<void> 2021-11-28 23:14:19 +01:00
String.cpp AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
String.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
StringBuilder.cpp AK: Add failable try_* functions to StringBuilder 2021-11-17 00:21:13 +01:00
StringBuilder.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
StringHash.h AK: Allow seed value to be specified in string_hash() 2021-10-25 23:37:18 +02:00
StringImpl.cpp AK: Add fast path for constructing StringImpl from "" literal 2021-10-25 13:29:44 +02:00
StringImpl.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
StringUtils.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
StringUtils.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
StringView.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
StringView.h AK: Verify that we are not overreaching in StringView's substring_view() 2021-11-16 00:49:48 +00:00
TemporaryChange.h Everything: Move to SPDX license identifiers in all files. 2021-04-22 11:22:27 +02:00
Time.cpp AK: Remove dead store from Time:operator+ 2021-09-01 01:22:14 +02:00
Time.h AK: Avoid implicit conversion clang-tidy warnings in AK::Time 2021-11-14 22:52:35 +01:00
Traits.h AK: Add Traits for Enums 2021-08-27 23:35:27 +04:30
Trie.h AK: Add children() accessor to Trie 2021-06-08 12:15:04 +02:00
Try.h AK+LibJS: Simplify MUST() and move it from LibJS to AK/Try.h 2021-11-10 21:58:58 +01:00
Tuple.h AK: Correct Tuple's constructor signatures 2021-08-02 17:22:50 +04:30
TypeCasts.h AK: Rename downcast<T> => verify_cast<T> 2021-06-24 19:57:01 +02:00
TypedTransfer.h AK: Resolve clang-tidy readability-bool-conversion warnings 2021-11-14 22:52:35 +01:00
TypeList.h Everywhere: "indexes" => "indices" 2021-04-29 22:23:52 +02:00
Types.h AK+Kernel: Suppress clang-tidy warnings from the cert-* category 2021-11-14 22:52:35 +01:00
UBSanitizer.h LibSanitizer+AK: Add float cast overflow handler 2021-08-08 10:55:36 +02:00
UFixedBigInt.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
UnicodeUtils.cpp AK: Add UnicodeUtils with Unicode-related helper functions 2021-05-20 22:10:45 +02:00
UnicodeUtils.h LibC: Implement wcrtomb 2021-10-15 21:50:19 -07:00
URL.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
URL.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
URLParser.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
URLParser.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Userspace.h AK+Kernel: Remove implicit conversion from Userspace<T*> to FlatPtr 2021-11-16 00:13:22 +01:00
Utf8View.cpp AK: Inline all the trivial Utf8View functions 2021-09-18 19:54:24 +02:00
Utf8View.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Utf16View.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Utf16View.h AK: Convert AK::Format formatting helpers to returning ErrorOr<void> 2021-11-17 00:21:13 +01:00
Utf32View.h AK: Add the at()/operator[]() getter to Utf32View 2021-07-18 21:10:55 +04:30
UUID.cpp Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
UUID.h Everywhere: Pass AK::StringView by value 2021-11-11 01:27:46 +01:00
Variant.h AK: Resolve clang-tidy warnings about unusual assignment operators 2021-11-14 22:52:35 +01:00
Vector.h AK: Stop Vector::extend from unnecessary reallocation 2021-11-28 13:33:51 -08:00
Weakable.h AK: Resolve clang-tidy readability-bool-conversion warnings 2021-11-14 22:52:35 +01:00
WeakPtr.h AK: Mark smart pointer classes as [[nodiscard]] 2021-12-05 15:31:03 +01:00