The callsites now mostly use MakeAndAddRef (which just stuffs a new object into
a RefPtr and calls `forget()` to yield an already_AddRefed).
In cases where the callsite constructs the object earlier and retains a strong
reference, they'll now use do_AddRef to explicitly generate a strong reference
(as an already_AddRefed) to pass into RegisterStrongMemoryReporter.
Differential Revision: https://phabricator.services.mozilla.com/D299042
This reverts commit 1ab110ab2f.
Revert "Bug 2037761: Change RegisterStrongMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug"
This reverts commit 2e187ddbc8.
The callsites now mostly use MakeAndAddRef (which just stuffs a new object into
a RefPtr and calls `forget()` to yield an already_AddRefed).
In cases where the callsite constructs the object earlier and retains a strong
reference, they'll now use do_AddRef to explicitly generate a strong reference
(as an already_AddRefed) to pass into RegisterStrongMemoryReporter.
Differential Revision: https://phabricator.services.mozilla.com/D299042
It was added in bug 494163 for smb: / sftp: handling.
But we've stopped using it for anything meaningful by default:
* bug 1433507 conditionally removed it.
* bug 1666725 removed smb: support.
* bug 1843763 removed sftp: support.
It's definitely not used in the codebase, and I haven't found any
remaining use of it outside (it wouldn't work unless with prefs
anyways).
So I'm fairly sure this is fine to kill nowadays.
Differential Revision: https://phabricator.services.mozilla.com/D292425
FreeObserverList appears in quite a few late shutdown hangs on CI. The current implementation has near-quadratic runtime, as we walk the entire callback list for each observer in the freed branch.
We can do better by just matching all callbacks for the branch in question in one linear sweep.
Differential Revision: https://phabricator.services.mozilla.com/D283453
Weak pref observer callbacks (CallbackNodes) were never removed from the
global callback list after the observer expired, causing unbounded growth.
This patch:
- Schedules an IdleTaskRunner to sweep expired weak callbacks, triggered
when a notification finds an expired observer or after every 512 weak
observer registrations.
- Fixes PrefCallback::KeyEquals to use the weak reference proxy object
for identity instead of the raw canonical nsISupports pointer, which
was vulnerable to address reuse after the observer was destroyed.
- Removes the now-unnecessary mCanonical field from PrefCallback.
- Adds gtests for both sweep trigger paths.
Differential Revision: https://phabricator.services.mozilla.com/D283452
FreeObserverList appears in quite a few late shutdown hangs on CI. The current implementation has near-quadratic runtime, as we walk the entire callback list for each observer in the freed branch.
We can do better by just matching all callbacks for the branch in question in one linear sweep.
Differential Revision: https://phabricator.services.mozilla.com/D283453
Weak pref observer callbacks (CallbackNodes) were never removed from the
global callback list after the observer expired, causing unbounded growth.
This patch:
- Schedules an IdleTaskRunner to sweep expired weak callbacks, triggered
when a notification finds an expired observer or after every 512 weak
observer registrations.
- Fixes PrefCallback::KeyEquals to use the weak reference proxy object
for identity instead of the raw canonical nsISupports pointer, which
was vulnerable to address reuse after the observer was destroyed.
- Removes the now-unnecessary mCanonical field from PrefCallback.
- Adds gtests for both sweep trigger paths.
Differential Revision: https://phabricator.services.mozilla.com/D283452
FreeObserverList appears in quite a few late shutdown hangs on CI. The current implementation has near-quadratic runtime, as we walk the entire callback list for each observer in the freed branch.
We can do better by just matching all callbacks for the branch in question in one linear sweep.
Differential Revision: https://phabricator.services.mozilla.com/D283453
Weak pref observer callbacks (CallbackNodes) were never removed from the
global callback list after the observer expired, causing unbounded growth.
This patch:
- Schedules an IdleTaskRunner to sweep expired weak callbacks, triggered
when a notification finds an expired observer or after every 512 weak
observer registrations.
- Fixes PrefCallback::KeyEquals to use the weak reference proxy object
for identity instead of the raw canonical nsISupports pointer, which
was vulnerable to address reuse after the observer was destroyed.
- Removes the now-unnecessary mCanonical field from PrefCallback.
- Adds gtests for both sweep trigger paths.
Differential Revision: https://phabricator.services.mozilla.com/D283452
FreeObserverList appears in quite a few late shutdown hangs on CI. The current implementation has near-quadratic runtime, as we walk the entire callback list for each observer in the freed branch.
We can do better by just matching all callbacks for the branch in question in one linear sweep.
Differential Revision: https://phabricator.services.mozilla.com/D283453
The CallbackNodes for Preference observers added with AddWeakObserver are never removed from our callback list.
We can do so in two occasion:
- when a specific pref change is notified but the callback expired
- at regular growth thresholds to avoid unbounded growth
The patch also adds tests for both.
Differential Revision: https://phabricator.services.mozilla.com/D283452
FreeObserverList appears in quite a few late shutdown hangs on CI. The current implementation has near-quadratic runtime, as we walk the entire callback list for each observer in the freed branch.
We can do better by just matching all callbacks for the branch in question in one linear sweep.
Differential Revision: https://phabricator.services.mozilla.com/D283453
The CallbackNodes for Preference observers added with AddWeakObserver are never removed from our callback list.
We can do so in two occasion:
- when a specific pref change is notified but the callback expired
- at regular growth thresholds to avoid unbounded growth
The patch also adds tests for both.
Differential Revision: https://phabricator.services.mozilla.com/D283452
We are seeing a lot of clients failing to parse their prefs file, and
we don't know why. This is a first step to help us figure out what's going
on; we can record the failure reason to see if one reason is much more
common than the others, which might indicate a common problem.
Note that the message we're recording is a static string, so there should
not be any data sensitivity concerns with this.
Differential Revision: https://phabricator.services.mozilla.com/D275627
Previously a burst of WritePrefFile calls could lead to saturize the underlying pool if the first event blocked on IO.
We can avoid this by going through a TaskQueue, and we can just use the background event target with DISPATCH_EVENT_MAY_BLOCK.
Differential Revision: https://phabricator.services.mozilla.com/D279526
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706