Commit Graph

53 Commits

Author SHA1 Message Date
Nicholas Nethercote
502d16e87f Bug 1416638 - Change nsPrefBranch mIsDefault to a PrefValueKind. r=glandium.
This makes the next patches nicer.

MozReview-Commit-ID: 8EoAkmmMavY

--HG--
extra : rebase_source : 3bb751c8e1353f7e3814257cf41f2f8de4ed3ed5
2017-11-14 19:06:02 +11:00
Nicholas Nethercote
f553c82da0 Bug 1416638 - Add a PrefValueKind arg to Preferences::Get*(), and remove Preferences::GetDefault*(). r=glandium
MozReview-Commit-ID: LgnZAf1pAl1

--HG--
extra : rebase_source : 8ba7c4bfb331f70fd41c2ae1d428e4cb9058d069
2017-11-14 19:06:01 +11:00
Nicholas Nethercote
6d0e1df407 Bug 1416638 - Add a PrefValueKind arg to Preferences::Set*(). r=glandium
This is unused for now, but will be necessary for nsPrefBranch::Set*() to call
into Preferences::Set*().

The patch also renames some arguments from aPref to aPrefName, because that's a
better name.

MozReview-Commit-ID: 2OPB7CHOgpw

--HG--
extra : rebase_source : 232b7be3c33d185f13ce86d91feea3b55069a4e6
2017-11-13 09:20:45 +11:00
Nicholas Nethercote
51c0610d9a Bug 1416638 - Introduce PrefValueKind. r=glandium
This is nicer than a bool for tracking the Default vs. User distinction, and it
replaces the Preferences.cpp-only WhichValue type.

MozReview-Commit-ID: 8CrdDN2vBJQ

--HG--
extra : rebase_source : 0d49148c73e5aeb0a355a6d4189232c89295d2a7
2017-11-13 09:20:42 +11:00
Nicholas Nethercote
994d5726c4 Bug 1416613 - Improve comments about pref IPC. r=glandium
These would have saved me some time last week when I was figuring out how this
stuff works.

MozReview-Commit-ID: DUhxGDht6xT
2017-11-13 09:19:43 +11:00
Nicholas Nethercote
680e88e4d4 Bug 1415799 - Inline and remove Preferences::Init(). r=glandium
It has a single call site.

MozReview-Commit-ID: A96MRRa3W5N

--HG--
extra : rebase_source : 243cecf21ed0ad9c0850a5efb8217c5bb3770d25
2017-11-09 17:59:51 +11:00
Nicholas Nethercote
c40b04cecd Bug 1415418 - Simplify GetUint(). r=glandium.
This makes it just like GetDefaultUint().

MozReview-Commit-ID: CSoLpLdstAv

--HG--
extra : rebase_source : 5ba8cb897c46197b7ef52c6c27b45ad223bc3d41
2017-11-08 16:45:42 +11:00
Nicholas Nethercote
882ae209b6 Bug 1415418 - Reorder Preferences.h. r=glandium.
The various getters and setters are in a confusing order. This patch puts them
in a more sensible order. It also streamlines the comments, which were
generally low-value and in some cases incorrect.

MozReview-Commit-ID: 3ngzZDSt0JI

--HG--
extra : rebase_source : 8a5a66f65621889483d2df9f4487194172f70804
2017-11-08 16:45:38 +11:00
Nicholas Nethercote
9245fb0232 Bug 1413400 (part 2) - Make Preferences::sPreferences a StaticRefPtr. r=froydnj.
The notable part of this change is Shutdown(). I've made it just null out
sPreferences, contrary to the old comment, which was strange for a couple of
reasons:

- ~Preferences() used to null out sPreference, which is backwards compared to
  how this sort of thing normally works.

- In both the before and after cases, as far as I can tell,
  Preferences::Shutdown() is called but ~Preferences() is never called;
  something keeps the singleton Preferences instance alive until process
  termination.

MozReview-Commit-ID: Ab0ui31rVcI
2017-11-01 13:55:28 +11:00
Nicholas Nethercote
3baceb4b37 Bug 1413400 (part 1) - Move s{,Default}RootBranch into Preferences. r=froydnj.
sRootBranch and sDefaultRootBranch have the same lifetime as sPreferences, so
this patch makes them non-static nsCOMPtr<> members of Preferences.

MozReview-Commit-ID: 1TLhh13ZpBI

--HG--
extra : rebase_source : 9419cd205b9a06f7ae82722a6732e3fc2722473b
2017-11-01 13:41:14 +11:00
Nicholas Nethercote
5f344fea70 Bug 1411480 (attempt 2) - Remove the machinery for choosing the dirty callback. r=glandium.
It's unnecessarily general, because we only ever use
Preferences::DirtyCallback() as the callback.

And because it's no longer a callback, the patch renames DirtyCallback() as
HandleDirty().

MozReview-Commit-ID: Hl50dcxfVQq

--HG--
extra : rebase_source : 5807d2ed650466f85cd7325f2adccdc177ccb4d2
2017-10-26 16:14:01 +11:00
Kris Maglione
257d9118dc Bug 1409249: Require singleton constructors to return explicit already_AddRefed. r=froydnj
Right now, NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR expects singleton
constructors to return already-addrefed raw pointers, and while it accepts
constructors that return already_AddRefed, most existing don't do so.

Meanwhile, the convention elsewhere is that a raw pointer return value is
owned by the callee, and that the caller needs to addref it if it wants to
keep its own reference to it.

The difference in convention makes it easy to leak (I've definitely caused
more than one shutdown leak this way), so it would be better if we required
the singleton getters to return an explicit already_AddRefed, which would
behave the same for all callers.


This also cleans up several singleton constructors that left a dangling
pointer to their singletons when their initialization methods failed, when
they released their references without clearing their global raw pointers.

MozReview-Commit-ID: 9peyG4pRYcr

--HG--
extra : rebase_source : 2f5bd89c17cb554541be38444672a827c1392f3f
2017-10-16 21:08:42 -07:00
Phil Ringnalda
535f8401d0 Backed out 11 changesets (bug 1411480) for libpref xpcshell test failures
Backed out changeset 0f266ffacf0d (bug 1411480)
Backed out changeset 75212b4a8c0a (bug 1411480)
Backed out changeset 0c807a8e8b29 (bug 1411480)
Backed out changeset 21324f73db0c (bug 1411480)
Backed out changeset f7de6fa0ef2c (bug 1411480)
Backed out changeset b7cdbe5153fa (bug 1411480)
Backed out changeset 8a66ec3e8338 (bug 1411480)
Backed out changeset 3fdf2ac7762d (bug 1411480)
Backed out changeset eaa177ef5f60 (bug 1411480)
Backed out changeset e87ba9542cf8 (bug 1411480)
Backed out changeset f1cf84a50ebc (bug 1411480)

MozReview-Commit-ID: GEVRPZp5eSH
2017-10-25 20:03:25 -07:00
Nicholas Nethercote
74915ed170 Bug 1411480 - Remove the machinery for choosing the dirty callback. r=glandium.
It's unnecessarily general, because we only ever use
Preferences::DirtyCallback() as the callback.

And because it's no longer a callback, the patch renames DirtyCallback() as
HandleDirty().

MozReview-Commit-ID: Hl50dcxfVQq

--HG--
extra : rebase_source : f453d31215de3fdb0c5b6176becf2669e7ad55f1
2017-10-25 10:22:38 +11:00
Nicholas Nethercote
003d9a950d Bug 1407494 (part 4) - Remove have_PrefChangedFunc_typedef. r=glandium.
This is detritus from old changes that can be cleaned up now.

The patch removes the declaration of PrefChangedFunc from Preferences.cpp
because it's also in Preferences.h, which is included by Preferences.cpp.

The patch also removes the part of the comment about passing a non-zero result
because it's clearly false -- the callback has no return value.

MozReview-Commit-ID: 72cdauYsRUt

--HG--
extra : rebase_source : 84cbbcea3b0ce3242c629e428be1e81be9cb5792
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
3c3c516563 Bug 1406280 - Restyle modules/libpref/*.h. r=erahm.
This is a mixture of clang-format and manual restyling.

MozReview-Commit-ID: 6S6yUDXQJtE

--HG--
extra : rebase_source : f7f52bd4c2fe9de1d5b6d99bf2daf841e511d913
2017-10-08 07:46:07 +11:00
Nicholas Nethercote
06f76edc17 Bug 1276488 - Add diagnostics about Prefs startup failures. r=froydnj.
--HG--
extra : rebase_source : ee3b8c2592e4dcf43c395cb805a88cfa385ce7ef
2017-09-06 15:17:05 +10:00
Masatoshi Kimura
b186427ed3 Bug 1374847 - Remove nsIPrefBranch2 and nsIPrefBranchInternal. r=njn
MozReview-Commit-ID: 2LFhKNVspko

--HG--
extra : rebase_source : 1acfd1427a2d81294d6cbc6358b1d1070b4c2c12
2017-08-04 17:12:58 +09:00
Nicholas Nethercote
72c884bf74 Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj.
--HG--
extra : rebase_source : d317b25be2ec21d1a60d25da3689e46cdce0b649
2017-07-31 14:28:48 +10:00
Nicholas Nethercote
d4f9aa5530 Bug 1384835 (part 2, attempt 2) - Remove the Preferences::Get*String() variants that return nsAdoptingString. r=froydnj.
--HG--
extra : rebase_source : 6c24fbacb03d4adebe5f22b5e7fc60b069913f20
2017-07-31 14:23:50 +10:00
Nicholas Nethercote
581214bd8b Bug 1384835 (part 1, attempt 2) - Use nsA[C]String references instead of pointers for outparams of Get*String() pref functions. r=froydnj.
--HG--
extra : rebase_source : fe566945a55c281d8290634a5b55bed19415c839
2017-07-31 10:52:51 +10:00
Benjamin Smedberg
2a757d9ae7 Bug 1382817 - Prefs shouldn't start out dirty or be written almost immediately after being read, r=milan
MozReview-Commit-ID: BFLMsMQjn9w

--HG--
extra : rebase_source : 9e9ba20270b055e8b1e3400c8926b7c4c932d752
2017-07-20 16:19:39 -04:00
Benjamin Smedberg
692b32a9b1 Bug 981818 followup - initialize member variable for correctness and valgrind happiness, r=trivial 2017-07-17 15:12:13 -04:00
Benjamin Smedberg
6231f9f89b Bug 981818 - Save preferences every time they are dirty on an timer for batching (only enabled when async pref writes are enabled) r=milan
MozReview-Commit-ID: 8O96jQIBsrb

--HG--
extra : rebase_source : 6f43b4b357e50b95b4b4919fb671dba000ceaf92
extra : source : 8b34a8ccdb17604b9bce0f228f8cab9710224331
2017-06-15 14:15:25 -04:00
Benjamin Smedberg
0ccf179dee Bug 1372988 part A - Warn when user prefs are set after the profile is dead, because the prefs won't get saved anyway. r=milan
MozReview-Commit-ID: IfwL5yYtLcF

--HG--
extra : rebase_source : ef1b78af09ac3966f16d4b255fe8689cb9c00aa2
extra : source : 93e8c43340e40fba20adc9e69131e4b7ec543153
2017-06-21 11:17:01 -04:00
Benjamin Smedberg
53c93f8449 Bug 1367813 - 1) Add telemetry for prefs.js not existing or being corrupted, and the presence of a user.js file. 2) Rename and change the nsIPrefService.readUserPrefs API. The new API reads user prefs from a file but doesn't remember that location or save changed preferences to that location. r=milan data-r=rweiss
MozReview-Commit-ID: FD5npJlB24W

--HG--
extra : rebase_source : d30bac5044ecb8d86253e8bca3e8d47371fb9d1f
extra : source : 4f0ee0f75a307095e4a04afe4413e5bb6ea8e502
2017-06-21 15:26:10 -04:00
Phil Ringnalda
c636da88e0 Backed out changeset 4f0ee0f75a30 (bug 1367813) for Windows opt permaorange in test_worker_basic.html
MozReview-Commit-ID: 2k693yFa28r
2017-06-22 20:43:11 -07:00
Phil Ringnalda
d20675b768 Backed out changeset 93e8c43340e4 (bug 1372988) for Windows opt permaorange in test_worker_basic.html
MozReview-Commit-ID: 6S8P6nsha0X
2017-06-22 20:42:40 -07:00
Benjamin Smedberg
bfee2567d6 Bug 1372988 part A - Warn when user prefs are set after the profile is dead, because the prefs won't get saved anyway. r=milan
MozReview-Commit-ID: IfwL5yYtLcF

--HG--
extra : rebase_source : f03a79b5f7c3b8eb802bfd2db9991e5ed6c74a8f
2017-06-21 11:17:01 -04:00
Benjamin Smedberg
5cf8c34a94 Bug 1367813 - 1) Add telemetry for prefs.js not existing or being corrupted, and the presence of a user.js file. 2) Rename and change the nsIPrefService.readUserPrefs API. The new API reads user prefs from a file but doesn't remember that location or save changed preferences to that location. r=milan data-r=rweiss
MozReview-Commit-ID: FD5npJlB24W

--HG--
extra : rebase_source : 049275836880f0aa4d19a9af2de9ec4101432b44
2017-06-21 15:26:10 -04:00
Gijs Kruitbosch
296bd92c9d Bug 789945: Part 1. Extract preference write functionality into a separate method/class and add interrupt callback functionality. Add methods to explicitly ask for main or off main thread save (inactive.) r=bsmedberg
MozReview-Commit-ID: FzI51oapEsL

--HG--
extra : rebase_source : 0e2c21f12b8cc69f4736a64e72c8500a770ed281
2016-01-01 12:39:02 +00:00
L. David Baron
24bffb840f Bug 1277709 - Make threadsafe reference counting use the minimum memory sychronization needed. r=froydnj
This uses std::atomic rather than mozilla::Atomic since mozilla::Atomic
does not support using different memory synchronization for different
atomic operations on the same variable.

The added comments could use careful review since, while they reflect my
understanding of the issue, I don't consider myself an expert on the
topic.

MozReview-Commit-ID: 7xByCXt17Dr

--HG--
extra : transplant_source : %8DM%88%E8%B7%B4%D8a%D6%F5%3F%9B%DC%09X%F3%7C%98%DE%21
2017-04-04 20:59:20 -07:00
Carsten "Tomcat" Book
68008bab43 Backed out changeset a52e75fdda07 (bug 1277709) for 10.10 xpcshell failures 2017-04-04 09:55:54 +02:00
L. David Baron
0b145fb182 Bug 1277709 - Make threadsafe reference counting use the minimum memory sychronization needed. r=froydnj
This uses std::atomic rather than mozilla::Atomic since mozilla::Atomic
does not support using different memory synchronization for different
atomic operations on the same variable.

The added comments could use careful review since, while they reflect my
understanding of the issue, I don't consider myself an expert on the
topic.

MozReview-Commit-ID: 7xByCXt17Dr

--HG--
extra : transplant_source : 8%8Ci%CC%EA%0F%CF%C7%3E%F1%93%F5%C9%ED9%84%F9%3Evx
2017-04-03 20:43:29 -07:00
Boris Zbarsky
246fba64e9 Bug 1348331 part 3. Change Preferences::RegisterCallback/RegisterCallbackAndCall/UnregisterCallback to do exact matching on the pref name, not prefix matching. r=froydnj.
MozReview-Commit-ID: GY6J62yWkfk
2017-03-21 14:59:02 -04:00
Boris Zbarsky
078380eae4 Bug 1348331 part 1. Add RegisterPrefixCallback and RegisterPrefixCallbackAndCall APIs to Preferences. r=froydnj
This will allow us to remove the PrefixMatch option from the public API version
of RegisterCallback/RegisterCallbackAndCall.

MozReview-Commit-ID: 6D0S35nv88Z
2017-03-21 14:59:02 -04:00
Boris Zbarsky
7525ff0157 Bug 1343677 part 1. Add a way to get the current preferences init phase in debug builds. r=billm
MozReview-Commit-ID: JtHhLuFDu2d
2017-03-16 17:43:17 -04:00
Brad Lassey
a5e07b93bf bug 1303096 - Stop sending sync messages soon after content process start-up r=billm 2017-02-05 00:52:38 -05:00
Sebastian Hengst
122ebc553b Backed out changeset e9d8a75a0dcc (bug 1303096) for failing various tests on Android 4.3 debug (e.g. test_saveHeapSnapshot_e10s_01.html). r=backout 2017-02-05 10:26:28 +01:00
Brad Lassey
ecdf363246 bug 1303096 - Stop sending sync messages soon after content process start-up r=billm 2017-02-05 00:52:38 -05:00
Milan Sreckovic
8d2fafb036 Bug 1287215: Replace preferences gDirty global with a callback. r=aklotz,Gijs
MozReview-Commit-ID: 7m5d5ddMTva

--HG--
extra : rebase_source : 6561ded096d914ca6b87d8eeda785538bbc225ac
2016-07-21 15:46:15 -04:00
David Anderson
d1ac63e903 Don't initialize gfxPrefs with libpref in the GPU process. (bug 1280822 part 1, r=milan) 2016-06-26 23:33:14 -07:00
Wes Kocher
1587b12aa9 Backed out 4 changesets (bug 1280822) for leaking nsTArray_base
Backed out changeset b9a0567cd7c1 (bug 1280822)
Backed out changeset 93d483583ffa (bug 1280822)
Backed out changeset 91715d8e468f (bug 1280822)
Backed out changeset 3db77f57cef4 (bug 1280822)
2016-06-24 14:43:41 -07:00
David Anderson
3d57c3eefa Don't initialize gfxPrefs with libpref in the GPU process. (bug 1280822 part 1, r=milan)
--HG--
extra : rebase_source : abe16841b668fb899b69f3ea9d941d5edb68ed21
2016-06-24 16:14:45 -07:00
Matt Woodrow
6451cce121 Bug 1267868 - Make AddXXXVarCache only match exact prefs, not prefixes. r=froydnj 2016-05-04 12:26:04 +12:00
Julian Seward
96a413ffed Bug 1248915 - TSan: data race on global 'mozilla::net::CacheObserver::sDiskCacheCapacity'. r=honzab.moz, n.nethercote. 2016-03-20 10:08:57 +01:00
Xidorn Quan
f062c6a861 Bug 1213123 - Make Preferences::SetString accept char16ptr_t instead of char16_t*. r=froydnj
--HG--
extra : source : 201ba51e2d2c674f3b6088ac255e2e6331d1a162
2015-10-10 12:19:23 +11:00
Birunthan Mohanathas
a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Andrea Marchesini
cb54385682 Bug 1156632 - Remove unused forward class declarations - patch 4 - netwerk image and dom, r=ehsan 2015-04-22 08:29:20 +02:00
Andrea Marchesini
e6f385fb3d Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00