Use rust types for basic shapes.

RESOLVED FIXED in Firefox 68

Status

()

defect
P3
normal
RESOLVED FIXED
3 months ago
3 months ago

People

(Reporter: emilio, Assigned: emilio)

Tracking

unspecified
mozilla68
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox68 fixed)

Details

Attachments

(2 attachments)

This is the first step to use more complex rust types in cbindgen.

For now, we'll use just a replacement for a boxed slice.

Afterwards, we should be able to do Atom, Arc and Box, and I think that's all we need to remove all the custom glue code and have something sane :)

Passing these by value won't be ok of course, but that's fine.

I plan to combine this with https://github.com/eqrion/cbindgen/pull/333 to
actually be able to share representation for ~all the things, this is just the
first bit. Box<T>, Atom and Arc<T> will be much easier since those have defined
memory layouts.

It's boxed slices the only ones I should need something like this. I could avoid
it if I rely on Rust's internal representation, but I'd rather not, it didn't
end up being as much work to do it right.

This enables destructors for tagged unions in cbindgen, implemented in:

Which allow us to properly generate a destructor for the cbindgen-generated
StyleBasicShape (which now contains an OwnedSlice).

For now, we still use the glue code to go from Box<BasicShape> to
UniquePtr<BasicShape>. But that will change in the future when we generate even
more stuff and remove all the glue.

I could add support for copy-constructor generation to cbindgen for tagged
enums, but I'm not sure if it'll end up being needed, and copy-constructing
unions in C++ is always very tricky.

Depends on D29768

Depends on: 1525402
Blocks: 1549559
Blocks: 1549593
Attachment #9062369 - Attachment description: Bug 1548691 - Add an owned slice type with defined layout for FFI. r=heycam → Bug 1548691 - Add an owned slice type which cbindgen can understand. r=heycam
Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/41acb048244d
Add an owned slice type which cbindgen can understand. r=heycam
https://hg.mozilla.org/integration/autoland/rev/fe11fc11ec5b
Use the owned slice type for basic shape polygon coordinates. r=TYLin,heycam
Status: NEW → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.