Commit graph

26 commits

Author SHA1 Message Date
Olivier Goffart
789ac719eb Make the parent_item function work with repeater component 2021-11-01 16:11:38 +01:00
Tobias Hunger
aea4ecca99 Apply pre-commit hooks to all files 2021-08-17 22:38:16 +02:00
Olivier Goffart
7cc13d78c3 C++ Make the stron_ref and weak_ref of VRc atomic
To match the equivalent in rust
2021-08-12 12:59:50 +02:00
Simon Hausmann
661f23760b Fix build: Add missing non-const arrow/deref operators for VRc/Component 2021-08-03 10:32:04 +02:00
Olivier Goffart
13bd828b96 Update license date 2021-07-02 15:55:54 +02:00
Olivier Goffart
ba1aff84d0 Layout refactoring: C++ part 2021-05-11 14:59:57 +02:00
Olivier Goffart
c2982d9ab3 Add ability to get the parent item from the vtable
(still untested)
2021-01-26 10:36:37 +01:00
Olivier Goffart
c7664f11ac C++: operator== for VRc 2021-01-22 13:03:02 +01:00
Olivier Goffart
090039094f C++: rename component_type to static_vtable
Then there is no reference to "component" in vtable.h
2021-01-14 09:39:21 +01:00
Olivier Goffart
1bcf446078 Delete the VRcInner destructor in hope this silence a MSVC warning 2021-01-14 09:31:47 +01:00
Simon Hausmann
78fae068dd Use ComponentRc during item tree traversal
This is in preparation for allowing the run-time / items to clone VRc's
of the component.

ComponentVTable functions like visit_children_item contine to take a
ComponentRefPin as "self" parameter type, as a VRc would not be
supported by rust right now. That means the implementation then uses
self_weak to obtain a strong self-reference.
2020-11-19 17:04:01 +01:00
Simon Hausmann
9c998c9e56 Add an into_dyn helper function to C++ VRc
This will be used in more places in the future, so centralize the ugly re-interpret cast.
2020-11-18 15:00:52 +01:00
Simon Hausmann
753ec83a05 Fix crash with VRc::borrow() on wasm32
When converting a Weak<VT, T> into Weak<VT, Dyn>, we were ignoring that
while T inside VRcInner may be at a certain offset to satisfy alignment,
the empty Dyn field may not and thus be at a different offset.

On wasm32 for example the compiler generated component struct has a
16-byte alignment, while the Dyn has none. So converting the Weak<VT,
Dyn> to a VRc<VT, Dyn> and then calling borrow() would use the wrong
instance pointer.

To fix this, this patch introduces an extra offset field that's
preserved during the casting and that's used for borrow() as well as
drop().
2020-11-12 11:04:56 +01:00
Olivier Goffart
d6a440aa4a Change C++ API to use the ComponentHandle 2020-11-10 19:28:34 +01:00
Olivier Goffart
3194dd21ca Expose VRc to the C++ API
(Not yet in use in the code gen)
2020-11-10 12:43:19 +01:00
Olivier Goffart
95c4bac794 Add a dealloc and drop_in_place function to the ComponentVTable 2020-11-06 17:13:01 +01:00
Olivier Goffart
58cdaeb8dd Update license header to mention that commertial option are available 2020-08-26 13:23:42 +02:00
Olivier Goffart
cbeb982684 Use the FieldOffset struct from the upstream create 2020-08-24 11:20:38 +02:00
Simon Hausmann
2823f32692 Apply license headers to all non-binary/non-json sources 2020-08-17 17:55:20 +02:00
Olivier Goffart
f50a705e00 Add the #[pin] attribute to be able to project to the pinned item 2020-06-25 12:18:09 +02:00
Olivier Goffart
caca0d0ba4 Put the component in a Pin<>
Removed the drop and create from the ComponentVTable:
since we are not using VBox<ComponentVTable>, this simplifies a bit
the code of the interpreter and everything else.

But there is still a lot of changes everywhere to support that the Component
is pinned.
This is just for the component. Which would be required if later we want
to access the properties as Pin<Property<_>>. But we have not yet ability
to do projections
2020-06-24 14:13:27 +02:00
Olivier Goffart
30b201d946 Reduce the use of unsafe in corelib and in the rust backend 2020-06-12 19:03:15 +02:00
Olivier Goffart
619e21295d reformat 2020-05-28 17:15:11 +02:00
Olivier Goffart
8ec6fd5237 Change the representation of the Property to be more FFI friendly 2020-05-19 15:09:45 +02:00
Olivier Goffart
544cb1a198 Fix C++ compilation using the vtable crate 2020-05-18 11:06:42 +02:00
Olivier Goffart
1ced4224b5 More work on the vtable crate 2020-05-18 11:04:54 +02:00