Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented slab storage that allocates handles (mozilla#1730)
This will be used for passing handles across the FFI. Use proptest to test the Rust implementation. Created a new fixture to test foreign bindings code for this. The docs list list of advantages to this, the main disadvantage is performance. We need to allocate a vec entry for the pointer and insert/remove/get need to take a lock. Compared `Arc<ConcreteType>` this is clearly worse. However, compared to `Arc<dyn Trait>` it's not so clear when we currently box the arc before passing it across the FFI. Compared to the foreign HandleMaps, I think the new system will be faster. It seems reasonable to trade some performance for the gains in simplicity and safety. The one thing that really bugs me is that `get()` needs to take a read lock. I'm pretty sure there's a couple ways to fix this, but I'm not sure if it's worth the complexity.
- Loading branch information