mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 11:49:44 +00:00
LibGC: Add a ForeignCell class for ownership of non-C++ objects
This will allow us to use the GC to manage the lifetime of objects that are not C++ objects, such as Swift objects. In the future we could expand this cursed FFI to other languages as well.
This commit is contained in:
parent
726f2cfb11
commit
829391e714
Notes:
github-actions[bot]
2024-11-19 21:54:22 +00:00
Author: https://github.com/ADKaster
Commit: 829391e714
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2386
Reviewed-by: https://github.com/alimpfard
11 changed files with 281 additions and 0 deletions
|
@ -7,6 +7,7 @@
|
|||
// RUN: %clang++ -cc1 -verify %plugin_opts% %s 2>&1
|
||||
// expected-no-diagnostics
|
||||
|
||||
#include <LibGC/ForeignCell.h>
|
||||
#include <LibJS/Runtime/PrototypeObject.h>
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
|
||||
|
@ -14,6 +15,10 @@ class TestCellClass : JS::Cell {
|
|||
GC_CELL(TestCellClass, JS::Cell);
|
||||
};
|
||||
|
||||
class TestForeignCellClass : GC::ForeignCell {
|
||||
FOREIGN_CELL(TestForeignCellClass, GC::ForeignCell);
|
||||
};
|
||||
|
||||
class TestObjectClass : JS::Object {
|
||||
JS_OBJECT(TestObjectClass, JS::Object);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue