mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
534fd0e715
`clone_from_bag` lets Rust code create a thread-safe `HashPropertyBag` from any kind of `nsIPropertyBag` by cloning its contents. This is important when you want to use a property bag that's passed to an XPIDL method off the main thread. An `nsIPropertyBag` passed from JS isn't thread-safe, since it's cycle-collected, and its properties are `XPCVariant`s. But a Rust `HashPropertyBag` is, because it's backed by a non-cycle collected `nsHashPropertyBag`, and the only supported properties are thread-safe storage variants. It also marks `HashPropertyBag` as `Send + Sync`, given that the only way to construct one is through `HashPropertyBag::new`, and `VariantType` is only implemented for storage variants. Finally, it adds more type tags for string (narrow and wide) variants, and changes the `VariantType for nsCString` getter to use `GetAsAUTF8String`, since that's what mozStorage implements for its text variant, not `GetAsACString`. Differential Revision: https://phabricator.services.mozilla.com/D67075 --HG-- extra : moz-landing-system : lando |
||
---|---|---|
.. | ||
src | ||
Cargo.toml |