Commit Graph
436 Commits
Author SHA1 Message Date
Gabriele Svelto f03cdb2b2d Bug 1600545 - Remove useless inclusions of header files generated from IDL files in modules/, netwerk/, parser/, security/, startupcache/, storage/, toolkit/, tools/, uriloader/, widget/, xpcom/ and xpfe/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55444
2019-12-06 09:17:57 +00:00
Jan de Mooij 844ff93d3b Bug 1579367 - Initialize XPCJSContext explicitly, after loading user prefs. r=kmag
This way we get the correct values for start-up prefs in the parent process.

Differential Revision: https://phabricator.services.mozilla.com/D51061
2019-11-22 12:40:17 +00:00
Geoff Brown 8eb3cfc128 Bug 1596962 - Initialize static pointers in Preferences.cpp; r=njn
Explicit initialization of these static pointers appears to resolve these intermittent failures.

Differential Revision: https://phabricator.services.mozilla.com/D53842
2019-11-20 17:13:34 +00:00
Jonathan Kew e6aca1e35d Bug 1586278 - Append ".0" to stringified default values of floating-point prefs to distinguish them from integers in about:config. r=njn
Differential Revision: https://phabricator.services.mozilla.com/D48197
2019-10-06 10:30:33 +00:00
Gerald Squelart e6057dd7de Bug 1576819 - Use PROFILER_ADD_MARKER{,_WITH_PAYLOAD} everywhere - r=gregtatum
All calls to `profiler_add_marker()` (outside of the profilers code) are
now replaced by either:
- `PROFILER_ADD_MARKER(name, categoryPair)`
- `PROFILER_ADD_MARKER_WITH_PAYLOAD(name, categoryPair, TypeOfMarkerPayload,
                                    (payload, ..., arguments))`

This makes all calls consistent, and they won't need to prefix the category pair
with `JS::ProfilingCategoryPair::`.

Also it will make it easier to add (and later remove) internal-profiling
instrumentation (bug 1576550), and to replace heap-allocated payloads with
stack-allocated ones (bug 1576555).

Differential Revision: https://phabricator.services.mozilla.com/D43588
2019-09-04 07:56:51 +00:00
Tom Ritter 3417fab73d Bug 1547519 - Rename NS_STRINGIFY to MOZ_STRINGIFY, move to mfbt, and unify stragglers r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D39961
2019-09-04 02:40:32 +00:00
Markus Stange 7973fe6357 Bug 1576263 - Conditionally include profiler functionality only where it's supported. r=whawkins,njn
Differential Revision: https://phabricator.services.mozilla.com/D44343
2019-09-02 20:35:48 +00:00
Nicholas Nethercote e96215c714 Bug 1573731 - Remove a diagnostic assertion in InitStaticPrefsFromShared(). r=jya
Because it's violated when updates occur, and when the violation occurs it's
safe to continue, for reasons explained in the patch. This should fix a top
crash.

Differential Revision: https://phabricator.services.mozilla.com/D44102
2019-08-30 09:21:33 +00:00
Will Hawkins 679819f4c1 Bug 1551313: Insert profiler markers when preferences are accessed. r=squib,gregtatum
Reviewers: squib, mstange, gregtatum

Reviewed By: squib, gregtatum

Subscribers: julienw, Fallen, reviewbot, mixedpuppy, mstange

Bug #: 1551313

Differential Revision: https://phabricator.services.mozilla.com/D39796
2019-08-23 13:12:51 +03:00
Nathan Froyd 5ada4b688b Bug 1575532 - avoid constructing needless strings in InitAlwaysPref; r=njn
Because `InitAlwaysPref` is an internal function, we can reasonably take
`const nsCString&` parameters, which avoids having to needlessly flatten
the already-flattened literal strings being passed to `InitAlwaysPref`.

Differential Revision: https://phabricator.services.mozilla.com/D42836
2019-08-21 20:37:51 +00:00
Nicholas Nethercote acad107547 Bug 1569526 - Remove CacheData. r=froydnj
A `CacheData` object holds two things: a VarCache/mirror variable address, and
a default value. The previous patch removed the use of the default value.
Therefore, `CacheData` now only holds an address, so there's no need for a
distinct heap object for it, and we can eliminate `CacheData` entirely and just
use the mirror variable address (a `void*`) directly.

The removal of the `CacheData` objects removes one reason for `gCacheData` to
exist (which is to have an owner for those objects). The other reason is to
detect if two or more prefs get VarCached onto a single variable. But given
that VarCaches are on the way out in favour of static prefs (bug 1448219) this
checking is no longer important. So the commit removes `gCacheData` as well.

The above changes save 20-32 KiB per process on 64-bit platforms.

The patch also removes `gCacheDataDesc`, a diagnostic thing from bug 1276488
that isn't relevant with `gCacheData` removed. This means the return type of
`InitInitialObjects` can be simplified.

Finally, the commit renames a few things, taking another step along the path of
renaming VarCache prefs as mirrored prefs, a much better name.

Differential Revision: https://phabricator.services.mozilla.com/D40906
2019-08-09 00:59:46 +00:00
Nicholas Nethercote 6778a47587 Bug 1569526 - Don't use default values as fallbacks for VarCache prefs. r=froydnj
This patch changes how a VarCache pref works when deleted (in some cases) --
the VarCache variable keeps its existing value instead of being reset to a
pre-specified default.

In bug 1570212 I have made sure that no VarCache prefs exhibit this behaviour
in practice any more, so this change should not affect functionality. There is
an assertion that checks this.

The next patch will take advantage of this change by removing the need to
store the pre-specified defaults, which will save memory.

Differential Revision: https://phabricator.services.mozilla.com/D39805
2019-08-09 00:59:34 +00:00
Nicholas Nethercote a35db866e0 Bug 1563555 - Rename sVarCache_* as sMirror_*. r=KrisWright
Another step in the renaming of VarCache variables as mirror variables,
matching the 'mirror' field used in StaticPrefList.yaml.

Differential Revision: https://phabricator.services.mozilla.com/D40794
2019-08-08 21:33:22 +00:00
Nicholas Nethercote 8b0d5497f3 Bug 1571961 - Shrink InitAll(). r=KrisWright
Avoiding lots of `if (isParent)` conditions reduces code size by 2016 bytes for
a local build on my Linux64 box.

Differential Revision: https://phabricator.services.mozilla.com/D40921
2019-08-07 21:39:08 +00:00
Nicholas Nethercote 5c2e267718 Bug 1563555 - Generate static pref getters usable from Rust code. r=glandium
This patch introduces a new Rust crate called `static_prefs`.

It also changes generate_static_pref_list.py to generate two new files.

- StaticPrefsCGetters.cpp: contains C getters, which are just wrappers around
  the C++ getters. This is included into Preferences.cpp.

- static_prefs.rs: contains declarations for the C getters, plus the `pref!`
  macro which provides nice syntax for calling the C getters. This is included
  into static_prefs/src/lib.rs.

The new code is only generated for prefs marked with the new `rust` field in
the YAML. It's opt-in because there's no point generating additional code for
900+ static prefs when only about 20 are currently used from Rust.

This patch only marks a single pref (`browser.display.document_color_use`) with
`rust: true`. That pref isn't accessed from Rust code in this patch, but it's
necessary because the generated Rust code is invalid if there are zero
Rust-accessed prefs. (The next patch will access that pref and others from Rust
code.

Differential Revision: https://phabricator.services.mozilla.com/D40791
2019-08-07 05:16:55 +00:00
Nicholas Nethercote f08218bb65 Bug 1570562 - Remove unnecessary checking in InitInitialObjects(). r=jya
Differential Revision: https://phabricator.services.mozilla.com/D40151
2019-08-04 23:04:09 +00:00
Nicholas Nethercote 38c3cc1f17 Bug 1570575 - Remove MirrorKind. r=KrisWright
This commit removes `MirrorKind` by splitting the `VARCACHE_PREF` macros in
two, giving `ALWAYS_PREF` and `ONCE_PREF` macros. This is good because most of
the time the generated code is quite different for the two cases.

The commit also removes the examples of code produced by the macros in
comments. These are kind of useful, but also quite verbose and a pain to
maintain.

Differential Revision: https://phabricator.services.mozilla.com/D40166
2019-08-02 06:31:05 +00:00
Nicholas Nethercote 8108ea6350 Bug 1570575 - Some libpref tidy-ups. r=KrisWright
This commit:

- improves the wording of some comments;

- renames `UpdatePolicy` as `MirrorKind`, to reflect the new terminology we are
  starting to use;

- does a couple of other minor clean-ups.

Differential Revision: https://phabricator.services.mozilla.com/D40161
2019-08-02 06:36:14 +00:00
Nicholas Nethercote b15904585a Bug 1567074 - Document libpref properly. r=jya
This is a combination of the All About Prefs google doc and kmag's description
of the shared memory work in
https://bugzilla.mozilla.org/show_bug.cgi?id=1471025#c95, with some updates and
tweaks.

Differential Revision: https://phabricator.services.mozilla.com/D38611
2019-08-01 02:11:07 +00:00
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