Commit Graph

453 Commits

Author SHA1 Message Date
Nicholas Nethercote
41b679b6e2 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

--HG--
extra : rebase_source : 13cf215aeb713e188103ef0cd04d094aa150853e
2019-06-25 10:36:59 +10:00
Nicholas Nethercote
9f15052ed8 Bug 1561216 - Remove unneeded mozilla:: qualifiers in Preferences.cpp. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D35772

--HG--
extra : rebase_source : 3844288a7aebe9759e8ba72cec44e94d96925f47
2019-06-25 09:18:07 +10:00
Nicholas Nethercote
c24fbafc40 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

--HG--
extra : moz-landing-system : lando
2019-06-24 16:43:33 +00:00
Jean-Yves Avenard
624887abc5 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

--HG--
extra : moz-landing-system : lando
2019-06-18 11:26:25 +00:00
Jean-Yves Avenard
b10113a9fc 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

--HG--
extra : moz-landing-system : lando
2019-06-18 11:25:21 +00:00
Jean-Yves Avenard
01ac9fc00f 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

--HG--
extra : moz-landing-system : lando
2019-06-19 00:22:33 +00:00
Jean-Yves Avenard
35eb8f536a Bug 1556131 - P3. Enable check on automation. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D34475

--HG--
extra : moz-landing-system : lando
2019-06-14 08:26:45 +00:00
Razvan Maries
8712f0bcbd 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
b402df7ecd Bug 1556131 - P2. Enable check on automation. r=njn
Depends on D34107

Differential Revision: https://phabricator.services.mozilla.com/D34475

--HG--
extra : moz-landing-system : lando
2019-06-12 21:49:50 +00:00
Jean-Yves Avenard
5adb6b1a6d Bug 1557630 - P1. Simplify Preferences' getters code. r=njn
We use templates where appropriate instead.

Differential Revision: https://phabricator.services.mozilla.com/D34272

--HG--
extra : moz-landing-system : lando
2019-06-12 08:01:08 +00:00
Bogdan Tara
e1a1a4aacc 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
d359bf9fb1 Bug 1556131 - P2. Enable check on automation. r=njn
Depends on D34107

Differential Revision: https://phabricator.services.mozilla.com/D34475

--HG--
extra : moz-landing-system : lando
2019-06-11 20:12:52 +00:00
Brindusan Cristian
f08a75f6a5 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
56773e45c8 Bug 1557630 - P1. Simplify Preferences' getters code. r=njn
We use templates where appropriate instead.

Differential Revision: https://phabricator.services.mozilla.com/D34272

--HG--
extra : moz-landing-system : lando
2019-06-11 06:11:50 +00:00
Jean-Yves Avenard
90a852278d 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

--HG--
extra : moz-landing-system : lando
2019-06-11 09:56:48 +00:00
Jean-Yves Avenard
4463ad6a27 Bug 1554334 - P2. Assert that Once StaticPrefs setter is never called once initialized. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D33630

--HG--
extra : moz-landing-system : lando
2019-06-11 06:32:59 +00:00
Jean-Yves Avenard
3cfadec356 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

--HG--
extra : moz-landing-system : lando
2019-06-11 06:32:45 +00:00
Jean-Yves Avenard
469acdb7c1 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

--HG--
extra : moz-landing-system : lando
2019-06-11 06:29:30 +00:00
Jean-Yves Avenard
1fabb3ce0b 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

--HG--
extra : moz-landing-system : lando
2019-06-11 06:29:26 +00:00
Boris Zbarsky
89baee69d9 Bug 1557501. Stop using [array] in nsIPrefBranch. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D34032

--HG--
extra : moz-landing-system : lando
2019-06-07 01:01:12 +00:00
Jean-Yves Avenard
62b101eb4f 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

--HG--
extra : moz-landing-system : lando
2019-05-26 14:32:27 +00:00
Jean-Yves Avenard
85777eccf3 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

--HG--
extra : moz-landing-system : lando
2019-05-26 14:29:52 +00:00
Jean-Yves Avenard
4b77501235 Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255

--HG--
extra : moz-landing-system : lando
2019-05-26 14:29:37 +00:00
Gurzau Raul
967bc2a754 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
abc6837058 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

--HG--
extra : moz-landing-system : lando
2019-05-24 11:39:31 +00:00
Jean-Yves Avenard
72db7328f0 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

--HG--
extra : moz-landing-system : lando
2019-05-25 00:03:53 +00:00
Jean-Yves Avenard
e47d662928 Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255

--HG--
extra : moz-landing-system : lando
2019-05-23 04:13:08 +00:00
Gurzau Raul
74c555539e 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
ccfd01b031 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

--HG--
extra : moz-landing-system : lando
2019-05-22 12:46:49 +00:00
Jean-Yves Avenard
01c1afee1c 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

--HG--
extra : moz-landing-system : lando
2019-05-22 16:59:29 +00:00
Jean-Yves Avenard
e4b5d5a8b8 Bug 1550422 - P11. Add atomic float preferences support. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D31255

--HG--
extra : moz-landing-system : lando
2019-05-22 12:42:55 +00:00
James Willcox
260fdd0caa Bug 1533051 - Load architecture-specific versions of other default pref files on Android r=njn
Differential Revision: https://phabricator.services.mozilla.com/D28995

--HG--
extra : moz-landing-system : lando
2019-04-30 23:28:32 +00:00
Gerald Squelart
e2d15a1cfb 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

--HG--
extra : moz-landing-system : lando
2019-04-02 11:53:47 +00:00
Alex Gaynor
1ad3f60e94 Bug 1536163 - Part 2 - use native Maybe syntax in place of MaybePrefValue in IPDL; r=mccr8
--HG--
extra : rebase_source : 9c93e3b61ceef67e33242af4415e144ff16ba49d
2019-03-21 06:51:43 +02:00
James Willcox
98778b5ae2 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

--HG--
extra : moz-landing-system : lando
2019-03-14 19:37:03 +00:00
Sylvestre Ledru
4aa92e3091 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
Andrea Marchesini
61816bf453 Bug 1532636 - nsPrefBranch should unregister itself as observer when shutting down, r=gsvelto
Differential Revision: https://phabricator.services.mozilla.com/D22086

--HG--
extra : moz-landing-system : lando
2019-03-06 08:55:23 +00:00
Ryan Hunt
c9ffe6a6c2 Bug 1523969 part 17 - Move method definition inline comments to new line in 'modules/'. r=ehsan
Differential Revision: https://phabricator.services.mozilla.com/D21118

--HG--
extra : rebase_source : 8808833f9c050424295a12486dedc574ab670ccd
2019-02-25 16:10:36 -06:00
Kris Maglione
b2f85650a1 Bug 1524687: Part 12 - Convert everything else to static registration. r=erahm
--HG--
extra : source : 625f71135038f79c075f758e316fbb00097c9a18
extra : intermediate-source : 7a1ef487a9e74d66b112034051e49b77023860b8
extra : histedit_source : 88d19dbee4a99faa191e49e2847c4c59aba05b0c%2C5ee702f97153152d31124e0c5f3e8318cbeb3195
2019-01-29 16:03:41 -08:00
arthur.iakab
470dbf03b6 Backed out 5 changesets (bug 1524687) for causing build bustages on platform.h CLOSED TREE
Backed out changeset 0f06a6b51bfe (bug 1524687)
Backed out changeset 7a1ef487a9e7 (bug 1524687)
Backed out changeset accad7b4cbc7 (bug 1524687)
Backed out changeset eb33f7e6467c (bug 1524687)
Backed out changeset 86cf09db340b (bug 1524687)
2019-02-21 02:04:02 +02:00
Kris Maglione
95c0cf7aa9 Bug 1524687: Part 12 - Convert everything else to static registration. r=erahm
--HG--
extra : rebase_source : ccc1b4f8559152237e523b67ea76e2b406c1cb11
extra : intermediate-source : e8ad5619116c31fc4d38e0e789ddb9b5d2a5bb25
extra : source : 625f71135038f79c075f758e316fbb00097c9a18
2019-01-29 16:03:41 -08:00
Ehsan Akhgari
e5e885ae31 Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre
# ignore-this-changeset

--HG--
extra : amend_source : 7221c8d15a765df71171099468e7c7faa648f37c
extra : histedit_source : a0cce6015636202bff09e35a13f72e03257a7695
2019-01-18 10:16:18 +01:00
Ehsan Akhgari
06c3d29113 Bug 1521000 - Part 1: Reformat the tree to ensure everything is formatted correctly with clang-format r=sylvestre
Summary: # ignore-this-changeset

Reviewers: sylvestre

Reviewed By: sylvestre

Subscribers: reviewbot, emilio, jandem, bbouvier, karlt, jya

Bug #: 1521000

Differential Revision: https://phabricator.services.mozilla.com/D16936

--HG--
extra : histedit_source : 4add583bfa729ccc1aef934629ed45ff095189b0
2019-01-18 10:12:56 +01:00
Dragana Damjanovic
fc155bc720 Bug 1513059 - Use the minimal XPCOM for the socket process.r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D15024

--HG--
extra : moz-landing-system : lando
2019-01-16 23:05:11 +00:00
Sylvestre Ledru
265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
James Willcox
c52752cf9e Bug 1502053 - Parse default prefs from MOZ_DEFAULT_PREFS env var r=njn
This will be used by GeckoView to set initial pref values that would
normally come from prefs.js or similar on desktop and Fennec.

Differential Revision: https://phabricator.services.mozilla.com/D9820
2018-11-01 09:53:31 -05:00
Gabriele Svelto
7089fe7369 Bug 1493955 - Store floating-point preferences in a locale-independent way r=njn
Differential Revision: https://phabricator.services.mozilla.com/D6796

--HG--
extra : moz-landing-system : lando
2018-09-28 20:54:09 +00:00
Bogdan Tara
8449b1c489 Backed out changeset ba1fef7b14eb (bug 1493955) for GTest failures CLOSED TREE 2018-09-28 02:42:20 +03:00
Gabriele Svelto
4d700e555a Bug 1493955 - Store floating-point preferences in a locale-independent way r=njn
Differential Revision: https://phabricator.services.mozilla.com/D6796

--HG--
extra : moz-landing-system : lando
2018-09-27 20:41:39 +00:00
Nathan Froyd
e7b3b3140d Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr. But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us). Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.

The current setup has two problems:

1) Derived classes should be using move construction, not copy
   construction, since anything that's shuffling hash table keys/entries
   around will be using move construction.

2) Derived classes should take responsibility for transferring bits of
   superclass state around, and not rely on something else to handle that.

The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the
place. Additionally, if moving entries is implemented via memcpy (which
is quite common), PLDHashTable copying around bits *again* is
inefficient.

Let's fix all these problems in one go, by:

1) Explicitly declaring the set of constructors that PLDHashEntryHdr
   implements (and does not implement). In particular, the copy
   constructor is deleted, so any derived classes that attempt to make
   themselves copyable will be detected at compile time: the compiler
   will complain that the superclass type is not copyable.

This change on its own will result in many compiler errors, so...

2) Change any derived classes to implement move constructors instead of
   copy constructors. Note that some of these move constructors are,
   strictly speaking, unnecessary, since the relevant classes are moved
   via memcpy in nsTHashtable and its derivatives.
2018-09-20 11:20:36 -04:00
Nicholas Nethercote
ea6e6b7d15 Bug 1488649 - Convert the prefs table from PLDHashTable to mozilla::HashSet. r=glandium
Because it's hot, and mozilla::HashSet is much faster than PLDHashTable.

--HG--
extra : rebase_source : 65efb5c25a01d03201eb31845f627b503efe7c9b
2018-09-07 09:51:22 +10:00
Nicholas Nethercote
fe34f19459 Bug 1486690 - Rename nsMemory::Clone() and remove unnecessary checks after it. r=glandium
The 'x' in the new name makes it clearer that it's infallible.

--HG--
extra : rebase_source : 51fd946c482befe8a8ca5bd88ecc967971f455da
2018-08-28 15:59:19 +10:00
Jorg K
cd598f0aaa Bug 1484809 - Put class nsRelativeFilePref into its own include file. r=njn
--HG--
extra : rebase_source : c775cdde24c8aa7134a7dd121abaf9233c8e2729
2018-08-21 00:28:00 +03:00
Ehsan Akhgari
e2e95ab324 Bug 1484109 - Part 3: Make nsRelativeFilePref final; r=njn 2018-08-17 10:27:24 -04:00
Ehsan Akhgari
3debcecb46 Bug 1484109 - Part 1: Remove the XPCOM component registration for nsRelativeFilePref; r=njn 2018-08-17 10:26:25 -04:00
Kris Maglione
f01e35b885 Bug 1477904: Correctly handle static var caches with changed default values. r=njn
MozReview-Commit-ID: H2ImQrmrtAV

--HG--
extra : rebase_source : bc1c43aba3d19b48e9ee3fc3d477138404009d10
2018-07-23 22:50:03 -07:00
Kris Maglione
d56573ecd5 Bug 1475836: Clear cached callback pref when deleting branch. r=njn
MozReview-Commit-ID: C60kGkoFBL8

--HG--
extra : source : 3b9846062755b05de6729a84aa2b0acf6ddfd0bc
2018-07-20 11:57:37 -07:00
Kris Maglione
4ef55072b9 Bug 1477254: Assert that varcache prefs match pref values at content process startup. r=njn
In order to avoid the overhead of doing a full pref lookup for every static
var cache at content process startup, we currently assume that the default
value of any static varcache pref will always match the default value of its
database entry (as long as the pref isn't locked). This lets us only perform
lookups for preferences which have a user value, or are locked.

If the default values of those preferences are changed in a bundled preference
file, though, the varcache value will be correct in the parent process, but
not in child processes. Since this is an easy mistake to make, we should
assert that it doesn't happen.

Note: This change only affects applications which use e10s. Applications like
Thunderbird can still override default values of any static pref with
impunity. Repacks and distributors can only do so by changing user values or
locking the preference after the change (which is the standard practice for
enterprise deployments).

MozReview-Commit-ID: JMHQBrp9HN

--HG--
extra : source : 1b389b00030ed38cdb3543aa5d1a67795be47565
extra : amend_source : 16f2dccf40664db9daa42a6edaabb933acbc6204
2018-07-23 17:32:54 -07:00
shindli
e0391b2197 Backed out 2 changesets (bug 1477254, bug 1475836) for bustages in builds/worker/workspace/build/src/modules/libpref/Preferences.cpp:4791:1 on a CLOSED TREE
Backed out changeset 1b389b00030e (bug 1477254)
Backed out changeset 3b9846062755 (bug 1475836)
2018-07-24 03:52:40 +03:00
Kris Maglione
e6eb6b8ea2 Bug 1477254: Assert that varcache prefs match pref values at content process startup. r=njn
In order to avoid the overhead of doing a full pref lookup for every static
var cache at content process startup, we currently assume that the default
value of any static varcache pref will always match the default value of its
database entry (as long as the pref isn't locked). This lets us only perform
lookups for preferences which have a user value, or are locked.

If the default values of those preferences are changed in a bundled preference
file, though, the varcache value will be correct in the parent process, but
not in child processes. Since this is an easy mistake to make, we should
assert that it doesn't happen.

Note: This change only affects applications which use e10s. Applications like
Thunderbird can still override default values of any static pref with
impunity. Repacks and distributors can only do so by changing user values or
locking the preference after the change (which is the standard practice for
enterprise deployments).

MozReview-Commit-ID: JMHQBrp9HN

--HG--
extra : rebase_source : 2f51295def52cbca316227f202158cb22656441a
2018-07-23 17:32:54 -07:00
Kris Maglione
bfc9a0bdfa Bug 1475836: Clear cached callback pref when deleting branch. r=njn
MozReview-Commit-ID: C60kGkoFBL8

--HG--
extra : rebase_source : 3c10097afb406750fe1c2f7410372f3dea4ce52a
2018-07-20 11:57:37 -07:00
Kris Maglione
a2be039491 Bug 1473634: Part 1 - Add preference callback variant which matches multiple prefs. r=njn
Preference callbacks consume a non-trivial amount of memory, which adds up
fast given the number of callbacks we register.

Many of our consumers, however, register a large number of callbacks with the
same function and closure object, but different preference names or prefixes.
Since our callback matching is nothing more complicated than iteration over
all of our registered callbacks, there's nothing that prevents us from
combining all of these into a single callback, with an array of preferences
rather than a single string.

And since we already allocate an extra 8 bytes for each callback object, we
can add a variant tag without increasing our allocation size.

MozReview-Commit-ID: I497lWfMUp3

--HG--
extra : rebase_source : bac374d9a590c325728551d1669ebc6ef8ca3884
2018-07-04 19:06:00 -07:00
Kris Maglione
9b42ce0a94 Bug 1471025: Part 7c - Clear the dynamic hashtable in the parent process after snapshotting. r=njn
The preference storage in the shared memory snapshot is much more compact than
the dynamic hashtable, and is already mapped in memory, so there's no need to
keep the full hashtable in memory in the parent process after the snapshot is
created.

This patch empties the hashtable and the name string arena after the snapshot.
It also removes the accounting for preferences which have changed after init,
since those are, by definition, exactly the set of entries in the dynamic
hashtable.

MozReview-Commit-ID: L6VGq2z4foH

--HG--
extra : intermediate-source : 6c72dc1bff88e81f6c754b0971a44b9592d17ee1
extra : absorb_source : 321a2ac3a2d26bbe089c2183e25fccc85d8689f3
extra : source : 599895de063ef005dbd34847db9ee555410a878f
extra : histedit_source : 5905f462ea3d1c935addbe847e53a7d8589f6f38
2018-07-02 22:48:40 -07:00
Kris Maglione
f2f08faf67 Bug 1471025: Part 7b - Don't load preference files in the content process. r=njn
With the parent sending a snapshot of its preference state at content process
startup, we're guaranteed to have the full set of built-in preferences in the
shared map at initialization time, so there's no need to load them again.

This also applies to static preference default values, so we skip setting
those, as well.

However, we do need to make sure that we update static preference cache
entries whose default values don't match the value in the shared map, since
they may have been changed by user preference files. In order to deal with
that, we iterate over all preferences in the map, and dispatch callbacks for
any that have user values.

MozReview-Commit-ID: DlRUbg7Qor3

--HG--
extra : intermediate-source : 7f4cc96fae1212cb2220770ac7311b9cc51af744
extra : absorb_source : 7c71a5994c26c2a1e34b291947a49ac5b3d633cb
extra : source : dc7ec17179d1961d91b897cec9f409786363ec9e
extra : histedit_source : f7c7a935e72af65446c2abc502744a066a6e2ae5%2C5cd3235724af3e5f22b772de171cea735ec4c047
2018-07-07 12:45:57 -07:00
Kris Maglione
ec11171950 Bug 1471025: Part 7a - Look up preferences from both dynamic and shared preference tables. r=njn
This patch changes our preference look-up behavior to first check the dynamic
hashtable, and then fall back to the shared map.

In order for this to work, we need to make several other changes as well:

- Attempts to modify a preference that only exists in the shared table
  requires that we copy it to the dynamic table, and change the value of the
  new entry.

- Attempts to clear a user preference with no default value, but which also
  exists in the shared map, requires that we keep an entry in the dynamic
  table to mask the shared entry. To make this work, we change the type of
  these entries to None, and ignore them during look-ups and iteration.

- Iteration needs to take both hashtables into consideration. The
  serialization iterator for changed preferences only needs to care about
  dynamic values, so it remains unchanged. Most of the others need to use
  PrefsIter() instead.

MozReview-Commit-ID: 9PWmSZxoC9Z

--HG--
extra : intermediate-source : b4f9178f132de2b5f7064df9a9e1b489ea6576c3
extra : absorb_source : 57fd90ea8195adff9d314b813e94dc643fd085e4
extra : source : 5051f15fc2005667cfe76ccae0afb1fb0657c103
extra : histedit_source : 2ebf0e90a5e1b65795b20e9269def7cbbf2d1f11
2018-07-02 22:52:53 -07:00
Kris Maglione
dd3de9e6b6 Bug 1471025: Part 6 - Optimize preference lookups while dispatching callbacks. r=njn
Since lookups in the snapshotted hashtable are currently O(log n) rather than
O(1), they're expected to be slightly more expensive than the previous
purely-dynamic lookups.

In general, I expect this not to be a major issue. The main concern is pref
cache lookups while initializing the database. Initialization in the parent
process will still always use only a dynamic hashtable, so the performance
characteristics there won't change.

In the child process, though, we'll still need to notify observers of
preferences in the snapshot when they have user values, which could require
any number of lookups at startup (though in practice probably will not).

This patch solves that problem by caching the wrapper for the current known
preference value when dispatching callbacks, and optimizing lookups for that
value when it is present.

MozReview-Commit-ID: 2CAn0rM0bE9

--HG--
extra : intermediate-source : 8eff817d2f7e07409269899c048a9091220dec07
extra : absorb_source : 2609b4d9d1d994e19f884de1d1fba38347d35729
extra : source : faef4df47b2089592df7637f5b8f4ae193e98046
extra : histedit_source : b8a1e41ac70ad3eea354c375fb5f6813c0284a0d
2018-07-07 12:47:34 -07:00
Kris Maglione
667653bbb3 Bug 1471025: Part 5 - Add a range iterator helper for iterating both static and dynamic preferences. r=njn
For memory efficiency in content processes, we need to be able to store
changed preferences in a separate dynamic hashtable when their values don't
match the snapshot values.

That makes iteration over the full set of preferences somewhat more
complicated, since not only do we need to iterate over two tables, but we also
need to ignore preferences in the snapshot table if they also exist in the
dynamic hashtable.

This patch solves that problem by adding an iterator helper which iterates
over values in both tables, and skips values in the static table if they also
exist in the dynamic table.

In order to support completely deleting preferences that exist in the base
table, it also ignores all dynamic entries with the None type, so that they
can completely mask deleted base table values.

MozReview-Commit-ID: LCIwyPJMByj

--HG--
extra : intermediate-source : f9362cf1add47c2f62529e42764ed6088d274170
extra : absorb_source : fdaf890e85af43271cffd2371cf6fbf408c6cc50
extra : source : d344247b870668f53fa645e72bda4bb4309346c8
extra : histedit_source : 6cd565727eff617eeba386b563477ce4d4bfbd0a
2018-07-02 18:17:48 -07:00
Kris Maglione
48cfff2489 Bug 1471025: Part 4 - Add a wrapper class that can access either static or dynamic prefs. r=njn
The in-memory format of shared-memory preferences is significantly different
from the format used by dynamic preferences, which means that we need
different classes to access their properties.

Virtual classes would be a potential solution to this problem, but I don't
think the performance characteristics would be acceptable for preferences
code. And since the wrapper classes used for static prefs are temporary, they
would add the additional snag of figuring out how to keep a valid pointer
alive.

So, instead, this patch adds a wrapper class that can access either type of
preference, based on known type flags in a Variant. It also moves some of the
logic for deciding which preference value to return to the wrapper, so that it
doesn't need to be duplicated for each representation.

MozReview-Commit-ID: LameIIbYcD3

--HG--
extra : intermediate-source : ce379eaab17905f39f1665c3e40f683ebd3f8824
extra : absorb_source : eb5ed3380613e070eff5f9c9501e2640a6d398f9
extra : source : 83d98ea5ebaccded8a20929c0f3316e5618f1f76
extra : histedit_source : 634d033608f72294f6fc34d4449fe0f003758c74
2018-07-01 23:23:48 -07:00
Kris Maglione
82bc4d713f Bug 1471025: Part 2 - Add a helper class creating and accessing shared preference map snapshots. r=njn,erahm
This is based on the SharedStringMap that's currently used for shared memory
string bundles.

When the parent process is ready to launch its first content process, it
creates a snapshot of the current state of the preference database, maps that
as read-only, and shares it with each content process. Look-ups in the
snapshotted map are done entirely using data in the shared memory region. It
doesn't require any additional per-process state data.

MozReview-Commit-ID: BdTUhak7dmS

--HG--
extra : intermediate-source : 434106f1b75e3ba900912f261bd22a1b7f5c931d
extra : absorb_source : 647ad37590448ad3c1eb8eb512bf671f262fa96e
extra : source : 68bb03c63b3cee1d47cbddfd3abf919f5783c04b
extra : histedit_source : 2228a9f8395929f5072a3c5ebda6ae3221e4a62d
2018-07-01 18:28:31 -07:00
Kris Maglione
9b5cf7e9da Bug 1471025: Part 1 - Store preference access counts in a separate hashtable. r=njn
Once the majority of preferences are stored in a read-only shared map, it
won't be possible to modify the access counts in their entries. Which means we
need a separate map for the access counts.

Fortunately, this code is only active in debug builds, so it shouldn't affect
release users. And the net impact on memory usage of this patchset will still
be decidedly downward.

MozReview-Commit-ID: EuLXlMQJP1M

--HG--
extra : intermediate-source : c490838c8329f6b0c21fa57ef078c44bf7a9ba8d
extra : absorb_source : 37a0f7a5fecba6c28bd6ce30644543c6d60ac823
extra : source : 4a8fbb472c91f13554cac3d0ea638cf9f368ff11
extra : histedit_source : 0e5a5f1cded97bcc959be15aa7194c017fd7efcc%2Cc0ae2011b9b40e6445ee366303f8ec4bb10cc87b
2018-07-02 23:33:28 -07:00
Brindusan Cristian
fe91a8922e Backed out 13 changesets (bug 1471025) for reftest failures on variation-format-hint-1a.html; bc failures performance/browser_preferences_usage.js; wpt failures on format-specifiers-variations.html. CLOSED TREE
Backed out changeset 6b672d70f335 (bug 1471025)
Backed out changeset 200bec7e766a (bug 1471025)
Backed out changeset 6c72dc1bff88 (bug 1471025)
Backed out changeset 7f4cc96fae12 (bug 1471025)
Backed out changeset b4f9178f132d (bug 1471025)
Backed out changeset 8eff817d2f7e (bug 1471025)
Backed out changeset f9362cf1add4 (bug 1471025)
Backed out changeset ce379eaab179 (bug 1471025)
Backed out changeset 7c03b7dd00e9 (bug 1471025)
Backed out changeset ff41551f5ff1 (bug 1471025)
Backed out changeset 46a6f9d0773b (bug 1471025)
Backed out changeset 434106f1b75e (bug 1471025)
Backed out changeset c490838c8329 (bug 1471025)
2018-07-14 01:16:06 +03:00
Kris Maglione
b9a91c1106 Bug 1471025: Part 7c - Clear the dynamic hashtable in the parent process after snapshotting. r=njn
The preference storage in the shared memory snapshot is much more compact than
the dynamic hashtable, and is already mapped in memory, so there's no need to
keep the full hashtable in memory in the parent process after the snapshot is
created.

This patch empties the hashtable and the name string arena after the snapshot.
It also removes the accounting for preferences which have changed after init,
since those are, by definition, exactly the set of entries in the dynamic
hashtable.

MozReview-Commit-ID: L6VGq2z4foH

--HG--
extra : source : 599895de063ef005dbd34847db9ee555410a878f
extra : histedit_source : a3bcc573e29a60a61abaa1b2cc6daa87d6b1a946
2018-07-02 22:48:40 -07:00
Kris Maglione
9e09f205af Bug 1471025: Part 7b - Don't load preference files in the content process. r=njn
With the parent sending a snapshot of its preference state at content process
startup, we're guaranteed to have the full set of built-in preferences in the
shared map at initialization time, so there's no need to load them again.

This also applies to static preference default values, so we skip setting
those, as well.

However, we do need to make sure that we update static preference cache
entries whose default values don't match the value in the shared map, since
they may have been changed by user preference files. In order to deal with
that, we iterate over all preferences in the map, and dispatch callbacks for
any that have user values.

MozReview-Commit-ID: DlRUbg7Qor3

--HG--
extra : source : dc7ec17179d1961d91b897cec9f409786363ec9e
extra : histedit_source : 285a99038c6731fed427cd8bc783b65f56e34ebb
2018-07-07 12:45:57 -07:00
Kris Maglione
79870c09c8 Bug 1471025: Part 7a - Look up preferences from both dynamic and shared preference tables. r=njn
This patch changes our preference look-up behavior to first check the dynamic
hashtable, and then fall back to the shared map.

In order for this to work, we need to make several other changes as well:

- Attempts to modify a preference that only exists in the shared table
  requires that we copy it to the dynamic table, and change the value of the
  new entry.

- Attempts to clear a user preference with no default value, but which also
  exists in the shared map, requires that we keep an entry in the dynamic
  table to mask the shared entry. To make this work, we change the type of
  these entries to None, and ignore them during look-ups and iteration.

- Iteration needs to take both hashtables into consideration. The
  serialization iterator for changed preferences only needs to care about
  dynamic values, so it remains unchanged. Most of the others need to use
  PrefsIter() instead.

MozReview-Commit-ID: 9PWmSZxoC9Z

--HG--
extra : source : 5051f15fc2005667cfe76ccae0afb1fb0657c103
extra : histedit_source : 28f2216b8c1e9d08ed9b2c03910d4b8434e55421
2018-07-02 22:52:53 -07:00
Kris Maglione
3bd442ec01 Bug 1471025: Part 6 - Optimize preference lookups while dispatching callbacks. r=njn
Since lookups in the snapshotted hashtable are currently O(log n) rather than
O(1), they're expected to be slightly more expensive than the previous
purely-dynamic lookups.

In general, I expect this not to be a major issue. The main concern is pref
cache lookups while initializing the database. Initialization in the parent
process will still always use only a dynamic hashtable, so the performance
characteristics there won't change.

In the child process, though, we'll still need to notify observers of
preferences in the snapshot when they have user values, which could require
any number of lookups at startup (though in practice probably will not).

This patch solves that problem by caching the wrapper for the current known
preference value when dispatching callbacks, and optimizing lookups for that
value when it is present.

MozReview-Commit-ID: 2CAn0rM0bE9

--HG--
extra : source : faef4df47b2089592df7637f5b8f4ae193e98046
extra : histedit_source : 3af498eac94f481523e86c31b9c2b3e55b3cd1fb
2018-07-07 12:47:34 -07:00
Kris Maglione
ee2ddcd56c Bug 1471025: Part 5 - Add a range iterator helper for iterating both static and dynamic preferences. r=njn
For memory efficiency in content processes, we need to be able to store
changed preferences in a separate dynamic hashtable when their values don't
match the snapshot values.

That makes iteration over the full set of preferences somewhat more
complicated, since not only do we need to iterate over two tables, but we also
need to ignore preferences in the snapshot table if they also exist in the
dynamic hashtable.

This patch solves that problem by adding an iterator helper which iterates
over values in both tables, and skips values in the static table if they also
exist in the dynamic table.

In order to support completely deleting preferences that exist in the base
table, it also ignores all dynamic entries with the None type, so that they
can completely mask deleted base table values.

MozReview-Commit-ID: LCIwyPJMByj

--HG--
extra : source : d344247b870668f53fa645e72bda4bb4309346c8
extra : histedit_source : bb670afc815f3953ccadebddd04962836569b281
2018-07-02 18:17:48 -07:00
Kris Maglione
bdb3eac1dd Bug 1471025: Part 4 - Add a wrapper class that can access either static or dynamic prefs. r=njn
The in-memory format of shared-memory preferences is significantly different
from the format used by dynamic preferences, which means that we need
different classes to access their properties.

Virtual classes would be a potential solution to this problem, but I don't
think the performance characteristics would be acceptable for preferences
code. And since the wrapper classes used for static prefs are temporary, they
would add the additional snag of figuring out how to keep a valid pointer
alive.

So, instead, this patch adds a wrapper class that can access either type of
preference, based on known type flags in a Variant. It also moves some of the
logic for deciding which preference value to return to the wrapper, so that it
doesn't need to be duplicated for each representation.

MozReview-Commit-ID: LameIIbYcD3

--HG--
extra : source : 83d98ea5ebaccded8a20929c0f3316e5618f1f76
extra : histedit_source : b3fc33ea04357e15323c7bcb1d02e73c1a9b0c76
2018-07-01 23:23:48 -07:00
Kris Maglione
7f2567e3d9 Bug 1471025: Part 2 - Add a helper class creating and accessing shared preference map snapshots. r=njn,erahm
This is based on the SharedStringMap that's currently used for shared memory
string bundles.

When the parent process is ready to launch its first content process, it
creates a snapshot of the current state of the preference database, maps that
as read-only, and shares it with each content process. Look-ups in the
snapshotted map are done entirely using data in the shared memory region. It
doesn't require any additional per-process state data.

MozReview-Commit-ID: BdTUhak7dmS

--HG--
extra : source : 68bb03c63b3cee1d47cbddfd3abf919f5783c04b
2018-07-01 18:28:31 -07:00
Kris Maglione
6949abebf4 Bug 1471025: Part 1 - Store preference access counts in a separate hashtable. r=njn
Once the majority of preferences are stored in a read-only shared map, it
won't be possible to modify the access counts in their entries. Which means we
need a separate map for the access counts.

Fortunately, this code is only active in debug builds, so it shouldn't affect
release users. And the net impact on memory usage of this patchset will still
be decidedly downward.

MozReview-Commit-ID: EuLXlMQJP1M

--HG--
extra : source : 4a8fbb472c91f13554cac3d0ea638cf9f368ff11
2018-07-02 23:33:28 -07:00
Brindusan Cristian
a68383b333 Backed out 12 changesets (bug 1471025) for build bustages on dom/ipc/ContentProcess.cpp. CLOSED TREE
Backed out changeset 398ccedc20dc (bug 1471025)
Backed out changeset 599895de063e (bug 1471025)
Backed out changeset dc7ec17179d1 (bug 1471025)
Backed out changeset 5051f15fc200 (bug 1471025)
Backed out changeset faef4df47b20 (bug 1471025)
Backed out changeset d344247b8706 (bug 1471025)
Backed out changeset 83d98ea5ebac (bug 1471025)
Backed out changeset 38f690f30e78 (bug 1471025)
Backed out changeset 4b7a8a35ed95 (bug 1471025)
Backed out changeset e3bbc87b71af (bug 1471025)
Backed out changeset 68bb03c63b3c (bug 1471025)
Backed out changeset 4a8fbb472c91 (bug 1471025)
2018-07-13 22:11:24 +03:00
Kris Maglione
e9a980f931 Bug 1471025: Part 7c - Clear the dynamic hashtable in the parent process after snapshotting. r=njn
The preference storage in the shared memory snapshot is much more compact than
the dynamic hashtable, and is already mapped in memory, so there's no need to
keep the full hashtable in memory in the parent process after the snapshot is
created.

This patch empties the hashtable and the name string arena after the snapshot.
It also removes the accounting for preferences which have changed after init,
since those are, by definition, exactly the set of entries in the dynamic
hashtable.

MozReview-Commit-ID: L6VGq2z4foH

--HG--
extra : rebase_source : d4ba3b6a0ae3d46cf797fd6aaf4502d7a74f49c9
extra : absorb_source : e8b2648578a880d43a5a3a075e60ce1433c737ce
2018-07-02 22:48:40 -07:00
Kris Maglione
c1de3fe2de Bug 1471025: Part 7b - Don't load preference files in the content process. r=njn
With the parent sending a snapshot of its preference state at content process
startup, we're guaranteed to have the full set of built-in preferences in the
shared map at initialization time, so there's no need to load them again.

This also applies to static preference default values, so we skip setting
those, as well.

However, we do need to make sure that we update static preference cache
entries whose default values don't match the value in the shared map, since
they may have been changed by user preference files. In order to deal with
that, we iterate over all preferences in the map, and dispatch callbacks for
any that have user values.

MozReview-Commit-ID: DlRUbg7Qor3

--HG--
extra : rebase_source : 93cad19e27d3aaf5d4cad358cdebd6d80b76f668
extra : absorb_source : 06cb8911c92b66f8863b5e184d88b923cdbd6adc
2018-07-07 12:45:57 -07:00
Kris Maglione
9128f02116 Bug 1471025: Part 7a - Look up preferences from both dynamic and shared preference tables. r=njn
This patch changes our preference look-up behavior to first check the dynamic
hashtable, and then fall back to the shared map.

In order for this to work, we need to make several other changes as well:

- Attempts to modify a preference that only exists in the shared table
  requires that we copy it to the dynamic table, and change the value of the
  new entry.

- Attempts to clear a user preference with no default value, but which also
  exists in the shared map, requires that we keep an entry in the dynamic
  table to mask the shared entry. To make this work, we change the type of
  these entries to None, and ignore them during look-ups and iteration.

- Iteration needs to take both hashtables into consideration. The
  serialization iterator for changed preferences only needs to care about
  dynamic values, so it remains unchanged. Most of the others need to use
  PrefsIter() instead.

MozReview-Commit-ID: 9PWmSZxoC9Z

--HG--
extra : rebase_source : 054f4dcd534b41da889304c3c6d3365d56e8edda
extra : absorb_source : de81199e174f2d3604c803a5c016ba2f3baf3558
2018-07-02 22:52:53 -07:00
Kris Maglione
50cbc3c826 Bug 1471025: Part 6 - Optimize preference lookups while dispatching callbacks. r=njn
Since lookups in the snapshotted hashtable are currently O(log n) rather than
O(1), they're expected to be slightly more expensive than the previous
purely-dynamic lookups.

In general, I expect this not to be a major issue. The main concern is pref
cache lookups while initializing the database. Initialization in the parent
process will still always use only a dynamic hashtable, so the performance
characteristics there won't change.

In the child process, though, we'll still need to notify observers of
preferences in the snapshot when they have user values, which could require
any number of lookups at startup (though in practice probably will not).

This patch solves that problem by caching the wrapper for the current known
preference value when dispatching callbacks, and optimizing lookups for that
value when it is present.

MozReview-Commit-ID: 2CAn0rM0bE9

--HG--
extra : rebase_source : 4a7e9611efe5b554309df18f7b18ba9c807b72b2
extra : absorb_source : 185442bd69d616c2d2512df954dde7d1b54f2c30
2018-07-07 12:47:34 -07:00
Kris Maglione
f1dd4a1a40 Bug 1471025: Part 5 - Add a range iterator helper for iterating both static and dynamic preferences. r=njn
For memory efficiency in content processes, we need to be able to store
changed preferences in a separate dynamic hashtable when their values don't
match the snapshot values.

That makes iteration over the full set of preferences somewhat more
complicated, since not only do we need to iterate over two tables, but we also
need to ignore preferences in the snapshot table if they also exist in the
dynamic hashtable.

This patch solves that problem by adding an iterator helper which iterates
over values in both tables, and skips values in the static table if they also
exist in the dynamic table.

In order to support completely deleting preferences that exist in the base
table, it also ignores all dynamic entries with the None type, so that they
can completely mask deleted base table values.

MozReview-Commit-ID: LCIwyPJMByj

--HG--
extra : rebase_source : 833abea0620f75410f9922e5d4b5cf36b84e9e50
extra : absorb_source : 89690c674120eb99ad25804408b1c3864c7b1fc8
2018-07-02 18:17:48 -07:00
Kris Maglione
62e557b598 Bug 1471025: Part 4 - Add a wrapper class that can access either static or dynamic prefs. r=njn
The in-memory format of shared-memory preferences is significantly different
from the format used by dynamic preferences, which means that we need
different classes to access their properties.

Virtual classes would be a potential solution to this problem, but I don't
think the performance characteristics would be acceptable for preferences
code. And since the wrapper classes used for static prefs are temporary, they
would add the additional snag of figuring out how to keep a valid pointer
alive.

So, instead, this patch adds a wrapper class that can access either type of
preference, based on known type flags in a Variant. It also moves some of the
logic for deciding which preference value to return to the wrapper, so that it
doesn't need to be duplicated for each representation.

MozReview-Commit-ID: LameIIbYcD3

--HG--
extra : rebase_source : bf986b6008123661547949f615c8416403321835
extra : absorb_source : e86aae959325a9c3198e0259468a47a656739278
2018-07-01 23:23:48 -07:00
Kris Maglione
68c9610957 Bug 1471025: Part 2 - Add a helper class creating and accessing shared preference map snapshots. r=njn,erahm
This is based on the SharedStringMap that's currently used for shared memory
string bundles.

When the parent process is ready to launch its first content process, it
creates a snapshot of the current state of the preference database, maps that
as read-only, and shares it with each content process. Look-ups in the
snapshotted map are done entirely using data in the shared memory region. It
doesn't require any additional per-process state data.

MozReview-Commit-ID: BdTUhak7dmS

--HG--
extra : rebase_source : e7cb96dd52380f2ed2fbd79b4e157e4efab65cb0
extra : absorb_source : ed95ed85388875353458eb65e41727e606ebf097
2018-07-01 18:28:31 -07:00
Kris Maglione
ea9eafabda Bug 1471025: Part 1 - Store preference access counts in a separate hashtable. r=njn
Once the majority of preferences are stored in a read-only shared map, it
won't be possible to modify the access counts in their entries. Which means we
need a separate map for the access counts.

Fortunately, this code is only active in debug builds, so it shouldn't affect
release users. And the net impact on memory usage of this patchset will still
be decidedly downward.

MozReview-Commit-ID: EuLXlMQJP1M

--HG--
extra : rebase_source : 6a32f03c37622093c67e7ee7a0e935d1e63c4fc8
2018-07-02 23:33:28 -07:00
Kris Maglione
17578086c0 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
MozReview-Commit-ID: EMCgMRTDqDn

--HG--
extra : rebase_source : 11731e5a7c53c725396a9c8b46f116071d0c6e31
2018-07-04 14:52:48 -07:00
Kris Maglione
d1882e4599 Bug 1472523: Part 3 - Use the same nsCString for pref callback/observer objects. r=njn
This reduced the additional string duplication that we currently do every time
we add a preference observer.

It changes the string that we store in the observer objects to be absolute,
rather than relative to the branch, but keeps the semantics the same, by
resolving the full preference name in the places we were previously matching
by relative string.

This actually has the effect of simplifying a lot of code, since the absolute
preference name is usually what we want.

MozReview-Commit-ID: 10WjHb0tNGB

--HG--
extra : rebase_source : b3cb0ba103fc239e42459e77cd389db0b5ecde18
2018-07-01 10:39:10 -07:00
Kris Maglione
3e400a8f72 Bug 1472523: Part 2 - Avoid unnecessary string copies in preference caches. r=njn
MozReview-Commit-ID: 74svGlwMVF1

--HG--
extra : rebase_source : ee25a335773b9afba9125c9092ed95eecc702cd9
2018-06-30 23:07:30 -07:00
Kris Maglione
8e4b8a954f Bug 1472523: Part 1 - Avoid string copies in preference callbacks. r=njn
Most preference callbacks use literal strings for their domain filters, which
means that there's no need to make copies of them at all. Currently, however,
every preference observer node makes a separate heap-allocated copy of its
domain string.

This patch switches the domain string storage to nsCString instances, which
dramatically reduces the amount of unnecessary copies, at the expense of
making the callback nodes slightly larger.

MozReview-Commit-ID: 8NA3t2JS2UI

--HG--
extra : rebase_source : 628ad9af65cec16fb8be0c8dddc608b5ee5602e2
2018-06-30 23:06:17 -07:00
Nicholas Nethercote
daeb7d6ea3 Bug 1461982 - Tidy up pref replacement. r=glandium
MozReview-Commit-ID: DYSxB3aqxIG

--HG--
extra : rebase_source : f5c1a1d466b21bdb837768297facce8c27cab3f9
2018-05-21 11:56:05 +10:00
Nicholas Nethercote
326416473a Bug 1461982 - Factor out some repeated code. r=glandium.
MozReview-Commit-ID: 10MmfP5hmvn

--HG--
extra : rebase_source : d33e12642a88ab57b8f7217a476e239219a9f705
2018-05-21 11:54:18 +10:00
Kris Maglione
6b12d08f7d Bug 1462937: Update callers to use nsIFile::GetDirectoryEntries as a nsIDirectoryEnumerator. r=froydnj
MozReview-Commit-ID: Iv4T1MVAF5

--HG--
extra : rebase_source : 1c518883d082884db7f9323a5acc20361228c26b
extra : histedit_source : 70a73c23d1199d3bfbb5379c78930401166c094b
2018-05-19 20:17:45 -07:00
Andrea Marchesini
423880eafd Bug 1450644 - Better shutdown approach for Workers - part 3 - Preference for time worker timeout, r=asuth 2018-04-17 20:51:04 +02:00
Tiberius Oros
78bac61f63 Backed out 7 changesets (bug 1450644, bug 1454633) for for failing browser_storage_permission.js on a CLOSED TREE
Backed out changeset f4989e0da221 (bug 1454633)
Backed out changeset 08239799d43e (bug 1450644)
Backed out changeset cbe3ad4833b6 (bug 1450644)
Backed out changeset 0d2088370d0c (bug 1450644)
Backed out changeset 246fb3ee14cd (bug 1450644)
Backed out changeset 629e499c0f75 (bug 1450644)
Backed out changeset ed93e3547096 (bug 1450644)
2018-04-18 01:10:26 +03:00
Andrea Marchesini
848a6e4716 Bug 1450644 - Better shutdown approach for Workers - part 3 - Preference for time worker timeout, r=asuth 2018-04-17 20:51:04 +02:00
Xidorn Quan
3181988f2e Bug 1449400 part 2 - Remove some dependencies from ServoStyleSet.h and add some random stuff to fix breakage. r=emilio
Some of the definitions are needed for the headers removal in
following patches.

MozReview-Commit-ID: BCj7U7RgBLj

--HG--
extra : rebase_source : e8e437f76c4db6ec930ea0481b6c1a38129a5477
extra : source : a1c42220e5070fa4beea438859ab0daec3f3fe7b
2018-03-29 22:15:46 +11:00
Nicholas Nethercote
4b59ef73a8 Bug 1449357 - Let prefs in data files override prefs in StaticPrefsList.h. r=glandium
This removes our ability to detect when an unnecessary override is occurring,
but it's necessary for Thunderbird to work.

MozReview-Commit-ID: GZYLnEEVuvd

--HG--
extra : rebase_source : ff3f7163252176d78ecf11589cebeae99f987985
2018-03-28 11:02:16 +11:00