ladybird/AK
Tom 75f61fe3d9 AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe
This makes most operations thread safe, especially so that they
can safely be used in the Kernel. This includes obtaining a strong
reference from a weak reference, which now requires an explicit
call to WeakPtr::strong_ref(). Another major change is that
Weakable::make_weak_ref() may require the explicit target type.
Previously we used reinterpret_cast in WeakPtr, assuming that it
can be properly converted. But WeakPtr does not necessarily have
the knowledge to be able to do this. Instead, we now ask the class
itself to deliver a WeakPtr to the type that we want.

Also, WeakLink is no longer specific to a target type. The reason
for this is that we want to be able to safely convert e.g. WeakPtr<T>
to WeakPtr<U>, and before this we just reinterpret_cast the internal
WeakLink<T> to WeakLink<U>, which is a bold assumption that it would
actually produce the correct code. Instead, WeakLink now operates
on just a raw pointer and we only make those constructors/operators
available if we can verify that it can be safely cast.

In order to guarantee thread safety, we now use the least significant
bit in the pointer for locking purposes. This also means that only
properly aligned pointers can be used.
2020-11-10 19:11:52 +01:00
..
Tests AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
Array.h AK: Add template deduction guides for Array. 2020-09-21 20:17:36 +02:00
Assertions.h AK+LibC: Add TODO() as an alternative to ASSERT_NOT_REACHED() 2020-05-30 11:31:49 +02:00
Atomic.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Badge.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Base64.cpp Base64: Pre-allocate size of input and output 2020-10-13 23:59:46 +02:00
Base64.h Base64: Pre-allocate size of input and output 2020-10-13 23:59:46 +02:00
BinarySearch.h BinarySearch: constexpr support 2020-10-17 23:19:37 +02:00
Bitmap.h Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
BitStream.h AK: Lower the requirements for InputStream::eof and rename it. 2020-09-14 20:58:12 +02:00
Buffered.h AK: Replace a write_or_error call with write. 2020-10-03 20:16:26 +02:00
ByteBuffer.cpp AK: Prevent confusing silent misuse of ByteBuffer 2020-08-22 17:18:14 +02:00
ByteBuffer.h AK: Fix ByteBuffer zero bytes allocations 2020-08-30 17:30:48 +02:00
Checked.h Everywhere: Redundant inline specifier on constexpr functions (#3807) 2020-10-20 18:08:13 +02:00
CircularDeque.h AK: Add enqueue_begin() for the CircularDeque class (#1320) 2020-03-02 09:50:43 +01:00
CircularDuplexStream.h AK: Lower the requirements for InputStream::eof and rename it. 2020-09-14 20:58:12 +02:00
CircularQueue.h AK: Add CircularDuplexStream class. 2020-08-26 21:07:53 +02:00
CMakeLists.txt Meta: Install source files at /usr/src/serenity 2020-08-15 15:06:35 +02:00
Concepts.h AK: Add SFINAE fallback for AK C++ concepts use, for Coverity compiler 2020-08-17 09:17:57 +02:00
Demangle.h Revert "AK: Don't demangle in serenity :(" 2020-05-20 16:24:26 +02:00
DistinctNumeric.h AK: Fix description of DistinctNumeric around operator bool 2020-08-22 17:18:14 +02:00
DoublyLinkedList.h AK: Make all DoublyLinkedList search methods use Traits<T>::equals (#3404) 2020-09-05 14:17:14 +02:00
Endian.h Endian: constexpr constructors and conversion operators 2020-10-08 23:28:54 +02:00
FlyString.cpp AK: Use StringImpl::operator== in FlyString 2020-10-06 17:43:51 +02:00
FlyString.h AK: Tweak String::is_one_of() and FlyString::is_one_of() 2020-07-28 18:55:47 +02:00
Format.cpp AK: Add formatters for floating point numbers. 2020-11-09 16:21:29 +01:00
Format.h AK: Add formatters for floating point numbers. 2020-11-09 16:21:29 +01:00
Forward.h AK: Add RefPtrTraits to allow implementing custom null pointers 2020-11-10 19:11:52 +01:00
Function.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
GenericLexer.cpp AK: Add GenericLexer::retreat() 2020-10-29 11:52:31 +01:00
GenericLexer.h AK: Add GenericLexer::retreat() 2020-10-29 11:52:31 +01:00
HashFunctions.h HashFunctions: constexpr capability 2020-10-21 19:42:12 +02:00
HashMap.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
HashTable.h AK: Reduce memory writes in HashTable destructor 2020-10-18 14:44:23 +02:00
IDAllocator.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
InlineLinkedList.h AK: Clear previous/next link in InlineLinkList::remove 2020-09-27 19:46:04 +02:00
IntrusiveList.h LibCore: Add a forward declaration header 2020-02-14 23:31:18 +01:00
IPv4Address.h AK: Use new format functions. 2020-10-08 09:59:55 +02:00
IterationDecision.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
Iterator.h AK: Add generic SimpleIterator class to replace VectorIterator. 2020-09-08 14:01:21 +02:00
JsonArray.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
JsonArraySerializer.h AK+Kernel: Escape JSON keys & values 2020-11-02 12:56:36 +01:00
JsonObject.h AK+Kernel: Escape JSON keys & values 2020-11-02 12:56:36 +01:00
JsonObjectSerializer.h AK+Kernel: Escape JSON keys & values 2020-11-02 12:56:36 +01:00
JsonParser.cpp AK: check fractional string has_value() in JsonParser 2020-10-06 14:27:51 +02:00
JsonParser.h AK: Remove empty destructor from JsonParser. 2020-09-08 14:01:21 +02:00
JsonPath.cpp Inspector: Expand and show properties in a TreeView 2020-07-01 11:18:19 +02:00
JsonPath.h Inspector: Expand and show properties in a TreeView 2020-07-01 11:18:19 +02:00
JsonValue.cpp AK: Fix JsonValue copy constructor behavior for 64-bit values 2020-07-06 18:38:08 +02:00
JsonValue.h Use new format functions in remaining DevTools. (#3755) 2020-10-13 18:34:27 +02:00
kmalloc.h AK: Always include <new> from compiler before our operators new 2020-11-05 09:59:30 +01:00
kstdio.h AK: Make the return type of dbgputstr consistent. 2020-10-04 19:18:32 +02:00
LexicalPath.cpp Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
LexicalPath.h AK: Add formatter for LexcialPath. 2020-10-09 20:52:17 +02:00
LogStream.cpp AK: Remove out() and warn(). 2020-11-09 16:21:29 +01:00
LogStream.h AK: Remove out() and warn(). 2020-11-09 16:21:29 +01:00
MACAddress.h AK: Use new format functions. 2020-10-08 09:59:55 +02:00
MappedFile.cpp AK: Use new format functions. 2020-10-08 09:59:55 +02:00
MappedFile.h AK: Make MappedFile store why it is invalid 2020-08-01 08:39:26 +02:00
MemMem.h AK+LibC+Kernel: Move the implementation of memmem to AK 2020-08-21 16:00:42 +02:00
Memory.h AK+LibC: Always use REP MOVSB/STOSB for memcpy()/memset() 2020-07-27 15:54:39 +02:00
MemoryStream.h AK: Use reference algorithms for LEB128 parsing 2020-11-08 22:38:27 +01:00
NeverDestroyed.h AK: Consider long and unsigned long as integral types. 2020-09-22 15:06:40 +02:00
Noncopyable.h Meta: Force semi-colon after MAKE_AK_NONXXXABLE() 2020-08-27 10:12:04 +02:00
NonnullOwnPtr.h AK: Add RefPtrTraits to allow implementing custom null pointers 2020-11-10 19:11:52 +01:00
NonnullOwnPtrVector.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
NonnullPtrVector.h AK: Add generic SimpleIterator class to replace VectorIterator. 2020-09-08 14:01:21 +02:00
NonnullRefPtr.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
NonnullRefPtrVector.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
NumberFormat.h AK: Use new format functions. 2020-10-08 09:59:55 +02:00
NumericLimits.h AK: Add NumericLimits specialization for char. 2020-09-29 16:14:58 +02:00
Optional.h AK: Add Optional::emplace method. 2020-08-30 09:56:10 +02:00
OwnPtr.h AK: Really disallow making OwnPtrs from refcounted types 2020-11-03 19:14:34 +01:00
Platform.h AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00
PrintfImplementation.h AK: printf was not accounting for plus sign with "%+d" 2020-11-05 11:04:10 +01:00
Queue.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
QuickSort.h AK: Dual pivot quicksort implementation (#1838) 2020-04-18 13:58:49 +02:00
Random.h Build: Modify various parts to allow the build to succeed on FreeBSD 2020-10-20 14:40:47 +02:00
RefCounted.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
RefPtr.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
Result.h AK: Make Buffered<T> non-copyable. 2020-10-03 20:16:26 +02:00
ScopedValueRollback.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
ScopeGuard.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
SharedBuffer.cpp AK: Use new format functions. 2020-10-08 09:59:55 +02:00
SharedBuffer.h AK: Add trivial structure validation to SharedBuffer 2020-10-02 15:38:07 +02:00
Singleton.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
SinglyLinkedList.h AK: SinglyLinkedList use Traits<T>::equals in find 2020-09-06 21:56:32 +02:00
SinglyLinkedListWithCount.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
SourceGenerator.h AK: Introduce SourceGenerator::fork(). 2020-10-24 12:56:25 +02:00
Span.h Span: constexpr support 2020-10-16 17:06:47 +02:00
StackInfo.cpp LibJS+AK: Move cross-platform stack bounds code from JS::Heap to AK::StackInfo 2020-11-08 16:51:54 +01:00
StackInfo.h LibJS+AK: Move cross-platform stack bounds code from JS::Heap to AK::StackInfo 2020-11-08 16:51:54 +01:00
StdLibExtras.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
Stream.h Everywhere: Fix more typos 2020-10-03 12:36:49 +02:00
String.cpp AK: Make String::matches() capable of reporting match positions too 2020-10-29 11:53:01 +01:00
String.h AK: Make String::matches() capable of reporting match positions too 2020-10-29 11:53:01 +01:00
StringBuilder.cpp AK+Kernel: Escape JSON keys & values 2020-11-02 12:56:36 +01:00
StringBuilder.h AK+Kernel: Escape JSON keys & values 2020-11-02 12:56:36 +01:00
StringImpl.cpp AK: Use new format functions. 2020-10-08 09:59:55 +02:00
StringImpl.h Everywhere: Redundant inline specifier on constexpr functions (#3807) 2020-10-20 18:08:13 +02:00
StringUtils.cpp AK: Make String::matches() capable of reporting match positions too 2020-10-29 11:53:01 +01:00
StringUtils.h AK: Make String::matches() capable of reporting match positions too 2020-10-29 11:53:01 +01:00
StringView.cpp AK: Make String::matches() capable of reporting match positions too 2020-10-29 11:53:01 +01:00
StringView.h AK: Remove duplicate begin()/end() methods 2020-11-07 18:28:35 +01:00
TemporaryChange.h Meta: Add license header to source files 2020-01-18 09:45:54 +01:00
TestSuite.h AK: Don't forward declare abort. 2020-10-14 11:29:29 +02:00
Time.cpp AK+LibC+LibCore: Have fewer implementations of day_of_week 2020-08-26 08:52:07 +02:00
Time.h Meta+AK: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Traits.h AK: Add HashMap, HashTable and Traits to Forward.h 2020-02-16 02:01:18 +01:00
TypeCasts.h AK: Add global is<T>() and downcast<T>() 2020-07-26 17:51:00 +02:00
TypedTransfer.h AK: Moved TypedTransfer into it's own header. 2020-09-09 20:15:50 +02:00
Types.h Everywhere: Redundant inline specifier on constexpr functions (#3807) 2020-10-20 18:08:13 +02:00
URL.cpp AK::URL: Check if URL requires a port set to be considered a valid URL 2020-11-04 19:34:00 +01:00
URL.h AK::URL: Check if URL requires a port set to be considered a valid URL 2020-11-04 19:34:00 +01:00
URLParser.cpp AK: Use new format functions. 2020-10-08 09:59:55 +02:00
URLParser.h AK: Add basic percent encoder/decoder (urlencode and urldecode) 2020-06-07 21:05:05 +02:00
Userspace.h AK: Prevent confusing silent misuse of Userspace<T> 2020-08-22 17:18:14 +02:00
Utf8View.cpp AK: Make Utf8View and Utf32View more consistent 2020-10-22 15:23:45 +02:00
Utf8View.h AK: Make Utf8View and Utf32View more consistent 2020-10-22 15:23:45 +02:00
Utf32View.h AK: Make Utf8View and Utf32View more consistent 2020-10-22 15:23:45 +02:00
Vector.h AK: Make Vector::remove_first_matching() signal if anything was removed 2020-10-06 18:38:18 +02:00
Weakable.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00
WeakPtr.h AK: Make RefPtr, NonnullRefPtr, WeakPtr thread safe 2020-11-10 19:11:52 +01:00