Commit Graph

117 Commits

Author SHA1 Message Date
Nicholas Nethercote
0f78d62710 Bug 1408231 - Remove unnecessary forward declarations and add |static| where appropriate. r=glandium.
This is possible now that all of libpref is in a single .cpp file.

For some functions, this required moving the comment from the forward
declaration to the definition.

MozReview-Commit-ID: 7XjHENZkc61
2017-10-13 15:24:59 +11:00
Nicholas Nethercote
a0479879cf Bug 1407494 (part 9) - Merge PREF_RegisterCallback() and PREF_RegisterPriorityCallback. r=glandium.
This avoids some code duplication.

MozReview-Commit-ID: 2Cb4YtL5RSu
2017-10-13 15:24:59 +11:00
Nicholas Nethercote
06b412d376 Bug 1407494 (part 8) - Remove forward declaration of PrefSetting. r=glandium.
It's declared in Preferences.h, which Preferences.cpp includes.

MozReview-Commit-ID: 7bjcgsrbfGl
2017-10-13 15:24:59 +11:00
Nicholas Nethercote
c9bfca98a1 Bug 1407494 (part 7) - Replace malloc uses with operator new. r=glandium.
MozReview-Commit-ID: 5mNDX95Cexn
2017-10-13 15:24:59 +11:00
Nicholas Nethercote
8126dcb303 Bug 1407494 (part 6) - Remove GetContentChild(). r=glandium.
We can just use XRE_IsContentProcess() instead, because the pointer return
value is only ever used in a bool context.

MozReview-Commit-ID: 6R4Bwf1cnKU
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
dc6b9487fa Bug 1407494 (part 5) - Replace uses of NS_strdup(), PL_strdup(), PL_strfree() with more standard functions. r=glandium.
MozReview-Commit-ID: FPDUZZqkHqg
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
0fc40eddec 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
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
e4eaa6bf6f Bug 1407494 (part 3) - Remove PR_ALIGN_OF_WORD and WORD_ALIGN_MASK. r=glandium.
Their last use was removed in bug 200524, 14.5 years ago.

MozReview-Commit-ID: FoM8KpJNA7m
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
7a2d697a50 Bug 1407494 (part 2) - Remove TEST_PREFREAD. r=glandium.
It's unclear how to compile it; it isn't a proper test, because it just prints
stuff out without explicitly checking anything; and I bet nobody has run it in
a long time.

MozReview-Commit-ID: 48s7pCy7HC6
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
4d9f11b58d Bug 1407494 (part 1) - Remove C-isms. r=glandium.
MozReview-Commit-ID: C2u2JpTkbkn
2017-10-13 15:24:58 +11:00
Nicholas Nethercote
82ec852f64 Bug 1407112 (part 4) - Merge prefapi.{cpp,h} and prefapi_private_data.h into Preferences.cpp. r=glandium.
This required moving WatchinPrefRAII and WATCHING_PREF_RAII

MozReview-Commit-ID: Kkefg2ouazK
2017-10-11 21:02:03 +11:00
Nicholas Nethercote
685e9e28e1 Bug 1407112 (part 3) - Merge prefread.{cpp,h} into Preferences.cpp. r=glandium.
Note: the #include of prefread.h from prefapi.cpp was unnecessary.

MozReview-Commit-ID: E0JefORRtgs
2017-10-11 20:31:35 +11:00
Nicholas Nethercote
4e39cc4d54 Bug 1407112 (part 2) - Merge nsPrefBranch.{cpp,h} into Preferences.cpp. r=glandium.
MozReview-Commit-ID: 3ugPL8ba6te
2017-10-11 20:31:32 +11:00
Nicholas Nethercote
7fbd9f1b01 Bug 1407112 (part 1) - Merge nsPrefsFactory.cpp into Preferences.cpp. r=glandium.
MozReview-Commit-ID: V1tONOw0wT
2017-10-11 19:03:23 +11:00
Nicholas Nethercote
d5c6ac2d61 Bug 1406280 - Restyle modules/libpref/*.h. r=erahm.
This is a mixture of clang-format and manual restyling.

MozReview-Commit-ID: 6S6yUDXQJtE
2017-10-08 07:46:07 +11:00
Nicholas Nethercote
c78a0ad7c6 Bug 1406205 - Restyle Preferences.cpp. r=felipe.
This is a mixture of clang-format and manual restyling.

MozReview-Commit-ID: G5ipKb1w5L0
2017-10-06 10:06:47 +11:00
Chris Peterson
e4f856dfc4 Bug 870698 - Part 11: Replace Insert(NS_LITERAL_STRING("")) with InsertLiteral(u""). r=erahm
The NS_LITERAL_STRING macro creates a temporary nsLiteralString to encapsulate the char16_t string literal and its length, but AssignLiteral() can determine the char16_t string literal's length at compile-time without nsLiteralString.

MozReview-Commit-ID: L9UE3gXHG4Q
2017-09-07 18:08:18 -07:00
Kris Maglione
b177113c1d Bug 1398357: Part 2 - Assert that Preferences methods observer/callback args are never null. r=njn
MozReview-Commit-ID: 10vbA1OnDC0
2017-09-08 14:36:54 -07:00
Nicholas Nethercote
a7e68f09c8 Bug 1276488 - Add diagnostics about Prefs startup failures. r=froydnj. 2017-09-06 15:17:05 +10:00
Kris Maglione
01d2c2b23c Bug 1363482: Part 8 - Preload preferences files off-thread during startup. r=erahm
MozReview-Commit-ID: 8NsxRw5KcZY
2017-08-31 17:02:09 -07:00
Nicholas Nethercote
be5f8887c1 Bug 1390428 (part 9) - Remove nsXPIDLCString. r=erahm.
This is straightforward, with only two notable things.

- `#include "nsXPIDLString.h" is replaced with `#include "nsString.h"`
  throughout, because all nsXPIDLString.h did was include nsString.h. The
  exception is for files which already include nsString.h, in which case the
  patch just removes the nsXPIDLString.h inclusion.

- The patch removes the |xpidl_string| gtest, but improves the |voided| test to
  cover some of its ground, e.g. testing Adopt(nullptr).
2017-08-17 15:29:03 +10:00
Nicholas Nethercote
b7346a7502 Bug 1390428 (part 1) - Remove many nsXPIDLCString local variables. r=erahm.
These are all easy cases where an nsXPIDLCString local variable is set via
getter_Copies() and then is only used in ways that nsCStrings can also be used
(i.e. no null checks or implicit conversions to |char*|).

In every case the patch trivially replaces the nsXPIDLCString with an
nsCString. (Also, there are a couple of unused nsXPIDLCString variables that
the patch simply removes.)
2017-08-16 13:58:35 +10:00
Milan Sreckovic
f82639b52d Bug 1388464: Use SyncRunnable instead of DISPATCH_SYNC to actually block the main thread during the blocking preference file write. r=smaug
MozReview-Commit-ID: 6J1252Q3pBr
2017-08-08 17:14:28 -04:00
Eric Rahm
1f532d0664 Bug 1386825 - Part 3: Remove MOZ_B2G from libpref. r=froydnj
MozReview-Commit-ID: GFLU2XF5yId
2017-08-08 14:41:08 -07:00
Masatoshi Kimura
3a683891af Bug 1374847 - Remove nsIPrefBranch2 and nsIPrefBranchInternal. r=njn
MozReview-Commit-ID: 2LFhKNVspko
2017-08-04 17:12:58 +09:00
Nicholas Nethercote
09493fcbcf Bug 1384835 (part 3, attempt 2) - Remove the Preferences::Get*CString() variants that return nsAdoptingCString. r=froydnj. 2017-07-31 14:28:48 +10:00
Nicholas Nethercote
a222153d9c Bug 1384835 (part 2, attempt 2) - Remove the Preferences::Get*String() variants that return nsAdoptingString. r=froydnj. 2017-07-31 14:23:50 +10:00
Nicholas Nethercote
636397db95 Bug 1384835 (part 1, attempt 2) - Use nsA[C]String references instead of pointers for outparams of Get*String() pref functions. r=froydnj. 2017-07-31 10:52:51 +10:00
Bevis Tseng
2ecbda13e2 Bug 1378930 - Part 2: Remove the aName parameter from SchedulerGroup/DocGroup/DispatcherTrait. r=billm 2017-07-26 16:13:35 +08:00
Benjamin Smedberg
251b00e475 Bug 1382817 - Prefs shouldn't start out dirty or be written almost immediately after being read, r=milan
MozReview-Commit-ID: BFLMsMQjn9w
2017-07-20 16:19:39 -04:00
Benjamin Smedberg
21d0e55716 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
2017-06-15 14:15:25 -04:00
Sylvestre Ledru
9d4a84d778 Bug 1378712 - Remove all trailing whitespaces r=Ehsan
MozReview-Commit-ID: Kdz2xtTF9EG
2017-07-06 14:00:35 +02:00
Benjamin Smedberg
2d53b5dd88 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
2017-06-21 11:17:01 -04:00
Benjamin Smedberg
9db7895288 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
2017-06-21 15:26:10 -04:00
Bill McCloskey
ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Nicholas Nethercote
a58025002f Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.

- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
  classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
  mostly misused.

- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
  universally available now anyway.

- Combines the first two string literal arguments of PROFILER_LABEL and
  PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
  them to be separate, and it forced a '::' in the label, which isn't always
  appropriate. Also, the meaning of the "name_space" argument was interpreted
  in an interesting variety of ways.

- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
  it clearer they construct RAII objects rather than just being function calls.
  (I myself have screwed up the scoping because of this in the past.)

- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
  the caller doesn't need to. This makes a *lot* more of the uses fit onto a
  single line.

The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).

- Fixes a bunch of labels that had gotten out of sync with the name of the
  class and/or function that encloses them.

- Removes a useless PROFILER_LABEL use within a trivial scope in
  EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
  any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
  a good idea.

- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
  done within them, instead of at their callsites, because that's a more
  standard way of doing things.
2017-06-22 17:08:53 +10:00
Phil Ringnalda
c64cad4109 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
be59e1915e 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
Phil Ringnalda
b1062ce1c9 Backed out changeset 8b34a8ccdb17 (bug 981818) for Windows opt permaorange in test_worker_basic.html
MozReview-Commit-ID: AeNMD3GbFUe
2017-06-22 20:41:59 -07:00
Benjamin Smedberg
b6c7037825 Bug 981818 - Save preferences every time they are dirty (on an idle timer for batching and jank reduction). r=milan
MozReview-Commit-ID: 8O96jQIBsrb
2017-06-15 14:15:25 -04:00
Benjamin Smedberg
004b69db2a 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
2017-06-21 11:17:01 -04:00
Benjamin Smedberg
d6e744168b 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
2017-06-21 15:26:10 -04:00
Carsten "Tomcat" Book
238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey
67e8af4720 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey
f69608368b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Milan Sreckovic
958ad89f0d Bug 1373250: encapsulate all of the memory management in a single structure so that we don't have to do any manual freeing. r=milan
MozReview-Commit-ID: 8hIm53rDUI3
2017-06-15 17:33:20 -04:00
Milan Sreckovic
7baf01695e Bug 789945: Part 3. Flush late in the shutdown, to give a last save a chance to complete and for the flush to not be blocking. r=bsmedberg"
MozReview-Commit-ID: 7w5Y16C7mTn
2017-06-14 13:38:08 -04:00
Milan Sreckovic
5cc473e71c Bug 789945: Part 2. Off main thread functionality for the save. r=bsmedberg
MozReview-Commit-ID: 2TmA59K4nSB
2017-06-14 13:37:28 -04:00
Gijs Kruitbosch
8d8c657317 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
2016-01-01 12:39:02 +00:00