On Thu, 18 Jul 2019 at 14:20, Nicholas Nethercote <n.netherc...@gmail.com>
wrote:

> Greetings,
>
> I just landed the patches in bug 1564724. As a result, static prefs are no
> longer defined in modules/libpref/init/StaticPrefList.h. They are now
> defined in modules/libpref/init/StaticPrefList.yaml, from which a
> StaticPrefList.h file is generated. The format is explained in a comment at
> the top of StaticPrefList.yaml.
> [...]
> The change will also allow some larger benefits in the immediate future.
> - Rust access to static prefs can become easier (bug 1563555
> <https://bugzilla.mozilla.org/show_bug.cgi?id=1563555>).
>

This has now landed. If you want to access a mirrored static pref from Rust
code, do the following.
- Add a `rust: true` field to the definition in StaticPrefList.yaml.
- Use the `pref!` macro from the `static_prefs` crate, e.g. `let
foo_bar_baz = static_prefs::pref!("foo.bar-baz");`

You can see real-world examples in Stylo.

In other libpref news, docs are now available here
<https://firefox-source-docs.mozilla.org/modules/libpref/libpref/index.html>.
Note particularly the "Guidelines" section, which discusses how we have too
many prefs (several thousand!) and has some ideas about which kinds of
prefs might be removable (hint, hint).

Finally, we have a long-running project to convert all VarCache prefs to
static prefs. See here
<https://wiki.mozilla.org/Platform/PrefsOverhaul#.5BON_TRACK.5D_static-prefs>
for a description of the benefits. Once all VarCache prefs have been
converted, we'll be able to do some nice clean-ups within libpref. There
are still roughly 200 prefs that need converting, and most conversions are
straightforward. Any help would be welcome. Instructions are here
<https://bugzilla.mozilla.org/show_bug.cgi?id=1448219#c3>. We don't want
any duplication of effort, so please use the tracking bug
<https://bugzilla.mozilla.org/show_bug.cgi?id=1448219> to see what others
are doing and communicate what you are doing. I am happy to review any
patches. Thanks.

Nick
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to