summaryrefslogtreecommitdiff
path: root/AK/RefCounted.h
AgeCommit message (Collapse)Author
2020-08-27Meta: Force semi-colon after MAKE_AK_NONXXXABLE()Ben Wiederhake
Before, we had about these occurrence counts: COPY: 13 without, 33 with MOVE: 12 without, 28 with Clearly, 'with' was the preferred way. However, this introduced double-semicolons all over the place, and caused some warnings to trigger. This patch *forces* the usage of a semi-colon when calling the macro, by removing the semi-colon within the macro. (And thus also gets rid of the double-semicolon.)
2020-06-12AK: Ensure RefCounted types are never copied or movedSergey Bugaev
Before this, it has been possible to assign a RefCounted object to another RefCounted object. Hilariosly (or sadly), that copied the refcount among the other fields, meaning the target value ended up with a wrong refcount. Ensure this never happens by disallowing copies and moves for RefCounted types.
2020-06-12AK: Assert refcount doesn't overflowSergey Bugaev
We don't really have a good way to prevent this kind of overflow, but let's at least immediately panic in this case.
2020-06-12AK: Switch RefCounted to atomic refcountingSergey Bugaev
This fixes all sorts of race conditions, primarily in the kernel, where till now it's been possible to obtain either double free or use-after-free by exploiting refcounting races.
2020-06-12AK: Use unsigned int for refcountSergey Bugaev
And while fixing all the tests that look at ref_count(), sneak in a fix for the test suite name.
2020-06-12AK: Ensure we never use OwnPtr<> with RefCounted typesSergey Bugaev
2020-05-20AK: Include Platform.h in RefCounted.h so we have ALWAYS_INLINEAndreas Kling
Otherwise Lagom doesn't build on my host machine.
2020-05-20AK+Kernel: Help the compiler inline a bunch of trivial methodsSergey Bugaev
If these methods get inlined, the compiler is able to statically eliminate most of the assertions. Alas, it doesn't realize this, and believes inlining them to be too expensive. So give it a strong hint that it's not the case. This *decreases* the kernel binary size.
2020-04-20AK: Allow having ref counted pointers to const objectItamar
We allow the ref-counting parts of an object to be mutated even when the object itself is a const. An important detail is that we allow invoking 'will_be_destroyed' and 'one_ref_left', which are not required to be const qualified, on const objects.
2020-02-09AK: Apply changes for the Bootstrapper environmentLiav A
2020-01-23AK: Let's call decrementing reference counts "unref" instead of "deref"Andreas Kling
It always bothered me that we're using the overloaded "dereference" term for this. Let's call it "unreference" instead. :^)
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-06-21AK: Rename Retainable.h => RefCounted.h.Andreas Kling