On 3/6/2014 4:05 PM, Benoit Girard wrote:
Thanks for doing this.

However I feel like our options for code that need preferences off the main
thread are a bit poor.
Yes. This is mostly intentional, because it's unusual to actually have user preferences affect threaded code behavior in ways that don't require knowledge of and cooperation from the main thread.

What is the use case where you need this?

  The first option is to send an IPC message to the
main thread but that has very poor performance, requires a lot of
boilerplate code and either an sync message or async+restructuring the
control flow. The second option is to read the preferences on startup and
have them as read-only shared globals like gfxPrefs:
http://mxr.mozilla.org/mozilla-central/source/gfx/thebes/gfxPrefs.h#106

The third option is to use pref observers and a lock to save the state of a pref in a protected variable. For cases where you actually want to honor runtime changes, this makes the most sense.

--BDS

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

Reply via email to