Files
tubestation/toolkit/components/uniffi-js
Ben Dean-Kawamura 67b31442a0 Bug 1913982 - Re-enable UniFFI callback interfaces, r=nika,lina
The FFI for this changed upstream.  Instead of registering a single
function that inputs a single buffer packed with all arguments, you now
register a function for each method where there is a 1-1 mapping of
arguments. The entire interface is represented by a "vtable" -- AKA a
struct that has a field for each of the method handler functions

To implement the methods, I stole the pattern we were using for regular
calls where we define a base class that's implemented by normal code and
a subclass that's implemented by generated code.

Registering/deregistering callback interfaces is now handled by the
generated code directly.  It's simpler this way and now that we don't
have the split between regular and fixture scaffolding, there's not much
need for shared code to handle this.

Kept the decision before to only support "fire-and-forget" callbacks. I
think we will want to revisit this when the we support UniFFI async, but
we can save that for later.

Differential Revision: https://phabricator.services.mozilla.com/D222027
2024-10-02 17:49:09 +00:00
..

uniffi-js

This directory contains C++ helper code for the UniFFI Rust library (https://github.com/mozilla/uniffi-rs/).

  • UniFFIPointer.* and UniFFIPointerType.* implement the UniFFIPointer WebIDL class

  • UniFFI*Scaffolding.cpp implements the UniFFIScaffolding WebIDL class.

    • UniFFIGeneratedScaffolding.cpp contains the generated C++ code
    • UniFFIScaffolding.cpp is a facade that wraps UniFFIFixtureScaffolding, and UniFFIGeneratedScaffolding if enabled, to implement the interface.
  • ScaffoldingConverter.h contain helper code to convert values between JS and Rust. This is used by the generated code to make scaffolding calls.

  • OwnedRustBuffer.* implements a C++ class to help manager ownership of a RustBuffer.

  • UniFFIRust.h contains definitions for the C functions that UniFFI exports.