Commit Graph
417 Commits
Author SHA1 Message Date
Nicholas Nethercote 3968b47d7e Bug 1569526 - Remove return values from Add*VarCache(). r=KrisWright
They're infallible in practice and always `NS_OK`. (This stems from
`AddVarCacheNoAssignment()` always returning `NS_OK`.)

As a result, the commit removes lots of unnecessary checks.

Differential Revision: https://phabricator.services.mozilla.com/D39804
2019-07-30 06:19:46 +00:00
Nicholas Nethercote 3d94e967b6 Bug 1569526 - Rename PreferencesInternalMethods. r=KrisWright
It's an annoyingly long name that causes lots of line breaking, and it's not
exposed outside of libpref.

Differential Revision: https://phabricator.services.mozilla.com/D39803
2019-07-30 06:14:48 +00:00
Nicholas Nethercote eb18791846 Bug 1569526 - Remove PrefsIter::Remove. r=KrisWright
It's unused.

Differential Revision: https://phabricator.services.mozilla.com/D39651
2019-07-30 06:14:29 +00:00
Nicholas Nethercote c0014abb9c Bug 1569526 - Rename SetPref_*() as InitPref_*(). r=KrisWright
This makes it clear that these run when prefs are initialized (like
`InitVarCache()`) rather than being vanilla `set` calls that happen at any
point during runtime.

Differential Revision: https://phabricator.services.mozilla.com/D39650
2019-07-30 06:14:17 +00:00
Nicholas Nethercote 72268fd4e6 Bug 1569526 - Add more thread/process assertions to libpref. r=KrisWright
Lots of operations in Preferences.cpp can only occur in the parent process
and/or on the main thread. It has a bunch of assertions to enforce/document
this. This commit adds some more, because they're really useful for
understanding the code.

The commit also removes an unnecessary `XRE_IsParentProcess()` check in
`pref_SetPref()` (because that condition is always true, as the added assertion
indicates), and renames a parameter in `InitVarCachePrefs()`.

Differential Revision: https://phabricator.services.mozilla.com/D39649
2019-07-30 06:14:05 +00:00
Nicholas Nethercote c0ba974463 Bug 1569036 - Remove all the aSkipAssignment parameters. r=KrisWright
`AddVarCache()` has a `bool aSkipAssignment` parameter. This patch removes that
parameter by splitting the function in two: `AddVarCache()` and
`AddVarCacheNoAssignment()`. (The former calls the latter.)

There are also tons of `Add*VarCache()` functions with `aSkipAssignment`
parameters that default to `false`. These defaults are never overridden, so
this patch removes the unnecessary arguments.

Differential Revision: https://phabricator.services.mozilla.com/D39433
2019-07-26 21:11:18 +00:00
Nicholas Nethercote c4aacd8403 Bug 1563139 - Remove StaticPrefs.h. r=glandium
This requires replacing inclusions of it with inclusions of more specific prefs
files.

The exception is that StaticPrefsAll.h, which is equivalent to StaticPrefs.h,
and is used in `Codegen.py` because doing something smarter is tricky and
suitable for a follow-up. As a result, any change to StaticPrefList.yaml will
still trigger recompilation of all the generated DOM bindings files, but that's
still a big improvement over trigger recompilation of every file that uses
static prefs.

Most of the changes in this commit are very boring. The only changes that are
not boring are modules/libpref/*, Codegen.py, and ServoBindings.toml.

Differential Revision: https://phabricator.services.mozilla.com/D39138
2019-07-26 01:10:23 +00:00
Nicholas Nethercote fded7bbbd1 Bug 1563139 - Remove StaticPref{s,List}_accessibility.h. r=glandium
These files exist because they were the proof-of-concept first step for
splitting the static prefs header files. Now that those header files can be
generated from a script, we need to move the `accessibility.*` prefs into the
YAML file.

Differential Revision: https://phabricator.services.mozilla.com/D39132
2019-07-25 04:08:14 +00:00
Nicholas Nethercote c79b54d1e2 Bug 1568516 - Allow a uint32_t static pref with a mirror value of never. r=KrisWright
There was a missing setter function for this combination, which hasn't been
used before.

Differential Revision: https://phabricator.services.mozilla.com/D39263
2019-07-25 02:26:14 +00:00
Nicholas Nethercote 462059ba06 Bug 1567329 - Append _AtStartup to once static pref getters. r=erahm
Currently it's completely unclear at use sites that the getters for `once`
static prefs return the pref value from startup, rather than the current pref
value. (Bugs have been caused by this.) This commit improves things by changing
the getter name to make it clear that the pref value obtained is from startup.

This required changing things within libpref so it distinguishes between the
"base id" (`foo_bar`) and the "full id" (`foo_bar` or
`foo_bar_DoNotUseDirectly` or `foo_bar_AtStartup` or
`foo_bar_AtStartup_DoNotUseDirectly`; the name used depends on the `mirror` and
`do_not_use_directly` values in the YAML definition.) The "full id" is used in
most places, while the "base id" is used for the `GetPrefName_*` and
`GetPrefDefault_*` functions.

(This is a nice demonstration of the benefits of the YAML file, BTW. Making
this change with the old code would have involved adding an entry to every
single pref in StaticPrefList.h.)

The patch also rejigs the comment at the top of StaticPrefList.yaml, to clarify
some things.

Differential Revision: https://phabricator.services.mozilla.com/D38604
2019-07-22 02:10:14 +00:00
Nicholas Nethercote 05fe155eeb Bug 1552126: Remove UpdatePolicy::Skip. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D37373
2019-07-10 22:32:58 +00:00
Barret Rennie 3620ac59d9 Bug 1289211 - Rename InfallibleTArray to nsTArray in modules/ r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D36965
2019-07-10 03:33:19 +00:00
Nicholas Nethercote 3f4419b95a Bug 1560530 - Split StaticPrefs_accessibility.h from StaticPrefs.h. r=froydnj
This implements the machinery for the splitting of static prefs headers, and
uses it for a single header. #includes are used in such a way that the amount
of boilerplate for each static prefs header file is minimal.

Future patches will split the remaining prefs into more header files.

Differential Revision: https://phabricator.services.mozilla.com/D36154
2019-07-08 23:40:39 +00:00
Nicholas Nethercote 301091a839 Bug 1562810 - Rename some static pref functions. r=KrisWright
Now that all static pref getters use snake_case, these renamings make sense:
- Getfoo_bar_bazPrefName() -> GetPrefName_foo_bar_baz()
- Getfoo_bar_bazPrefDefault() -> GetPrefDefault_foo_bar_baz()

Differential Revision: https://phabricator.services.mozilla.com/D36563
2019-07-02 22:32:09 +00:00
Nicholas Nethercote 8c91e2c074 Bug 1561216 - Change StaticPrefs from a class to a namespace. r=froydnj
This doesn't change the way C++ code uses static prefs. But it does slightly
change how Rust code uses static prefs, specifically the name generated by
bindgen is slightly different.

The commit also improves some comments.

Differential Revision: https://phabricator.services.mozilla.com/D35764
2019-06-25 10:36:59 +10:00
Nicholas Nethercote ee172fedcc Bug 1561216 - Remove unneeded mozilla:: qualifiers in Preferences.cpp. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D35772
2019-06-25 09:18:07 +10:00
Nicholas Nethercote eb58dd1dd3 Bug 1560833 - Remove setters for static VarCache prefs. r=froydnj
Static VarCache prefs have setters. These are dangerous because they can
violate the primary invariant of VarCache prefs, which is that the global
variable always matches the pref value in the table.

Fortunately they are only used in tests, and we can use vanilla pref setters
instead, and get rid of the VarCache setters.

Differential Revision: https://phabricator.services.mozilla.com/D35632
2019-06-24 16:43:33 +00:00
Jean-Yves Avenard bb38fafd50 Bug 1559563 - P2. Small optimization of Once StaticPrefs accessor. r=njn
We can avoid testing if we are running in the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D35125
2019-06-18 11:26:25 +00:00
Jean-Yves Avenard 16f460dfa9 Bug 1559563 - P1. Move StaticPrefs accessor back to header file. r=njn
This allows for the compiler to inline the code where appropriate.

Differential Revision: https://phabricator.services.mozilla.com/D35124
2019-06-18 11:25:21 +00:00
Jean-Yves Avenard e16e710cb7 Bug 1559675 - P1. Initialize StaticPrefs early in non-parent process. r=njn
We can initialize the StaticPrefs as soon as the SharedMap object is created outside the parent process.

Additionally when resetting the preferences to their default values, we no longer modify the `Once` StaticPrefs as they are immutable, only the underlying preference.

Differential Revision: https://phabricator.services.mozilla.com/D35263
2019-06-19 00:22:33 +00:00
Jean-Yves Avenard df7f12ef75 Bug 1556131 - P3. Enable check on automation. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D34475
2019-06-14 08:26:45 +00:00
Razvan Maries 8dccece4a5 Backed out changeset f2fa56561f9e (bug 1556131) for causing perma failure: Assertion failure: staticPrefValue == preferenceValue 2019-06-13 06:12:12 +03:00
Jean-Yves Avenard 53973ca0e9 Bug 1556131 - P2. Enable check on automation. r=njn
Depends on D34107

Differential Revision: https://phabricator.services.mozilla.com/D34475
2019-06-12 21:49:50 +00:00
Jean-Yves Avenard b05f508df9 Bug 1557630 - P1. Simplify Preferences' getters code. r=njn
We use templates where appropriate instead.

Differential Revision: https://phabricator.services.mozilla.com/D34272
2019-06-12 08:01:08 +00:00
Bogdan Tara ab06749697 Backed out changeset c0931707a491 (bug 1556131) for assertion failures in StaticPrefList.h CLOSED TREE 2019-06-12 05:18:24 +03:00
Jean-Yves Avenard 9b644891f8 Bug 1556131 - P2. Enable check on automation. r=njn
Depends on D34107

Differential Revision: https://phabricator.services.mozilla.com/D34475
2019-06-11 20:12:52 +00:00
Brindusan Cristian c7cf59c33c Backed out changeset a36380745805 (bug 1557630) for mochitest failures at test_pluginAudioNotification.html. CLOSED TREE 2019-06-11 19:32:38 +03:00
Jean-Yves Avenard 70f6c8fcac Bug 1557630 - P1. Simplify Preferences' getters code. r=njn
We use templates where appropriate instead.

Differential Revision: https://phabricator.services.mozilla.com/D34272
2019-06-11 06:11:50 +00:00
Jean-Yves Avenard 5a0c8ce96d Bug 1556131 - P1. Potentially assert that a Once StaticPref stays in sync with underlying preference. r=njn
When testing, the Preference behing a `Once` StaticPrefs should never get modified as this indicate that this StaticPrefs should have a `Live` policy instead.

This is placed behind the preferences.check.once.policy which will get enabled during automated testing.

Differential Revision: https://phabricator.services.mozilla.com/D34107
2019-06-11 09:56:48 +00:00
Jean-Yves Avenard 0978a62ed8 Bug 1554334 - P2. Assert that Once StaticPrefs setter is never called once initialized. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D33630
2019-06-11 06:32:59 +00:00
Jean-Yves Avenard 65fd6f6fe7 Bug 1554334 - P1. Lazily initialize StaticPrefs with Once policy. r=njn
Rather than attempting to determine when the Once policy StaticPrefs should be set we initialize them when one of the getter gets called. They become immutable after that.
In a future change we will prevent those values to ever be changed once they have been initialized.

Differential Revision: https://phabricator.services.mozilla.com/D33440
2019-06-11 06:32:45 +00:00
Jean-Yves Avenard d07b10266b Bug 1554559 - P3. Make Once StaticPrefs immutable once SharedPreferenceMap has been created. r=njn
When we create the SharedPreferenceMap we store the value of the Once pref in it. All child processes will now read the Once pref from the read-only SharedPreferenceMap.
This makes the Once prefs immutable once we start the first child process.

Differential Revision: https://phabricator.services.mozilla.com/D33421
2019-06-11 06:29:30 +00:00
Jean-Yves Avenard 2ac62c1fba Bug 1554559 - P2. Add option for pref entry in SharedPrefMap to be skipped by iterator. r=njn
This allows for an entry to not show in about:config.

This will be used to store Once StaticPrefs once they become immutable.

Differential Revision: https://phabricator.services.mozilla.com/D33420
2019-06-11 06:29:26 +00:00
Boris Zbarsky cae135dd3f Bug 1557501. Stop using [array] in nsIPrefBranch. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D34032
2019-06-07 01:01:12 +00:00
Jean-Yves Avenard 19cefad5bf Bug 1550422 - P26. Make setter only usable on main process. r=njn
And set the underlying preference. StaticPrefs::Set becomes a convenience access to the original preference which is what gfxPrefs was actually doing.

Differential Revision: https://phabricator.services.mozilla.com/D31749
2019-05-26 14:32:27 +00:00
Jean-Yves Avenard ec82582f0b Bug 1550422 - P13. Add Skip, Once and Live cached preference policy. r=njn,kmag
This works identically to what gfxPrefs UpdatePolicy offers.

Differential Revision: https://phabricator.services.mozilla.com/D31257
2019-05-26 14:29:52 +00:00
Jean-Yves Avenard 7c067b7f6f Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255
2019-05-26 14:29:37 +00:00
Gurzau Raul 938877e121 Backed out 31 changesets (bug 1552643, bug 1550422) for xpcshell crash on a CLOSED TREE.
Backed out changeset e30c1aa75529 (bug 1552643)
Backed out changeset caadcd7e02d3 (bug 1552643)
Backed out changeset aa7086ab09be (bug 1552643)
Backed out changeset 0b4029671710 (bug 1550422)
Backed out changeset a16295296035 (bug 1550422)
Backed out changeset 3b70307c0db5 (bug 1550422)
Backed out changeset 69df7818d4a3 (bug 1550422)
Backed out changeset d98dfc565927 (bug 1550422)
Backed out changeset 6f0997976944 (bug 1550422)
Backed out changeset 0edd264464c2 (bug 1550422)
Backed out changeset 9ea6da7a74ec (bug 1550422)
Backed out changeset f855f9309c8b (bug 1550422)
Backed out changeset 1033546224a7 (bug 1550422)
Backed out changeset ade7384c6186 (bug 1550422)
Backed out changeset 75b04de7e99c (bug 1550422)
Backed out changeset 91c3acdb2454 (bug 1550422)
Backed out changeset 77d2f80257d1 (bug 1550422)
Backed out changeset e0cd10d35327 (bug 1550422)
Backed out changeset 097091082423 (bug 1550422)
Backed out changeset 2f328853c1ab (bug 1550422)
Backed out changeset f92f2cc29cb1 (bug 1550422)
Backed out changeset 6dc82f88333d (bug 1550422)
Backed out changeset c20f66494d69 (bug 1550422)
Backed out changeset 2ba22cddeb6f (bug 1550422)
Backed out changeset 3aa72f89e295 (bug 1550422)
Backed out changeset ab4c4e806977 (bug 1550422)
Backed out changeset 72e5de040dda (bug 1550422)
Backed out changeset 7d3c2d486706 (bug 1550422)
Backed out changeset 132e0b8d8468 (bug 1550422)
Backed out changeset 54c85ac75dd0 (bug 1550422)
Backed out changeset d7ba4a18dd54 (bug 1550422)
2019-05-25 09:07:49 +03:00
Jean-Yves Avenard 40f318152f Bug 1550422 - P26. Make setter only usable on main process. r=njn
And set the underlying preference. StaticPrefs::Set becomes a convenience access to the original preference which is what gfxPrefs was actually doing.

Differential Revision: https://phabricator.services.mozilla.com/D31749
2019-05-24 11:39:31 +00:00
Jean-Yves Avenard d24cc50c67 Bug 1550422 - P13. Add Skip, Once and Live cached preference policy. r=njn,kmag
This works identically to what gfxPrefs UpdatePolicy offers.

Differential Revision: https://phabricator.services.mozilla.com/D31257
2019-05-25 00:03:53 +00:00
Jean-Yves Avenard 5dca4607e7 Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255
2019-05-23 04:13:08 +00:00
Gurzau Raul 8d7b43d90a Backed out 28 changesets (bug 1550422) for marionette AssertionError and failing browser_policy_hardware_acceleration.js on a CLOSED TREE.
Backed out changeset 5dd10a365ba9 (bug 1550422)
Backed out changeset 529f5be01ab9 (bug 1550422)
Backed out changeset b6861d3badf8 (bug 1550422)
Backed out changeset 059cff1a3dde (bug 1550422)
Backed out changeset 6ada1116b241 (bug 1550422)
Backed out changeset ca67e8e45262 (bug 1550422)
Backed out changeset a1961a51ae44 (bug 1550422)
Backed out changeset 1c90b9cb3ad4 (bug 1550422)
Backed out changeset 285fa46e4f26 (bug 1550422)
Backed out changeset e2938a444234 (bug 1550422)
Backed out changeset 7a930fc51125 (bug 1550422)
Backed out changeset 898ed02804fe (bug 1550422)
Backed out changeset e1b7abc99ae9 (bug 1550422)
Backed out changeset f781d415cef6 (bug 1550422)
Backed out changeset 2fef10a7cce5 (bug 1550422)
Backed out changeset ea64b4d8d4ff (bug 1550422)
Backed out changeset 86a8ba1b755c (bug 1550422)
Backed out changeset 9c0c9e80f309 (bug 1550422)
Backed out changeset 10c153ddbaea (bug 1550422)
Backed out changeset 60fe635ec2c9 (bug 1550422)
Backed out changeset a38796266b28 (bug 1550422)
Backed out changeset 2db647dcdf1c (bug 1550422)
Backed out changeset 952ddac02972 (bug 1550422)
Backed out changeset ba46b53643ec (bug 1550422)
Backed out changeset ca47ef6c59f7 (bug 1550422)
Backed out changeset f45f471a1a40 (bug 1550422)
Backed out changeset 371b4da5b771 (bug 1550422)
Backed out changeset 02fc78890032 (bug 1550422)
2019-05-23 05:59:44 +03:00
Jean-Yves Avenard 519229e2f9 Bug 1550422 - P26. Make setter only usable on main process. r=njn
And set the underlying preference. StaticPrefs::Set becomes a convenience access to the original preference which is what gfxPrefs was actually doing.

Differential Revision: https://phabricator.services.mozilla.com/D31749
2019-05-22 12:46:49 +00:00
Jean-Yves Avenard c6fbf33e02 Bug 1550422 - P13. Add Skip, Once and Live cached preference policy. r=njn,kmag
This works identically to what gfxPrefs UpdatePolicy offers.

Differential Revision: https://phabricator.services.mozilla.com/D31257
2019-05-22 16:59:29 +00:00
Jean-Yves Avenard 01b3a3aff1 Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255
2019-05-22 12:42:55 +00:00
James Willcox 03d394c76a Bug 1533051 - Load architecture-specific versions of other default pref files on Android r=njn
Differential Revision: https://phabricator.services.mozilla.com/D28995
2019-04-30 23:28:32 +00:00
Gerald Squelart e376dc5b78 Bug 1429613 - Variant matcher callbacks renamed from match to operator() - r=froydnj
Mechanical change from Matcher::match(...) to Matcher::operator()(...).
This will now permit the use of generic lambdas, and facilitate the
implementation of multi-lambda match.

Differential Revision: https://phabricator.services.mozilla.com/D24889
2019-04-02 11:53:47 +00:00
Alex Gaynor a0b5d73b3c Bug 1536163 - Part 2 - use native Maybe syntax in place of MaybePrefValue in IPDL; r=mccr8 2019-03-21 06:51:43 +02:00
James Willcox 5a84e71b29 Bug 1533425 - Look for architecture-specific greprefs.js files on Android r=njn
We want to publish a multi-architecture AAR for GeckoView which includes
a single omni.ja, but we archicture-specific changes in greprefs.js that
prevent this from working. This patch causes us to try to read an
architecture-specific greprefs.js first, which will be provided by the
packaging process for the fat AAR.

Differential Revision: https://phabricator.services.mozilla.com/D22526
2019-03-14 19:37:03 +00:00
Sylvestre Ledru b31009da86 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D22514
2019-03-13 10:19:06 +01:00