Граф коммитов

2211 Коммитов

Автор SHA1 Сообщение Дата
Andreas Pehrson 9717c27492 Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright
Because DelayedRunnables are fire-and-forget, there is no way for a targeted
EventTarget to clean them up on shutdown. Thus if a timer fires after
EventTarget shutdown it will fail to dispatch the timer event, and avoid
releasing the timer callback because it's not on the targeted thread. This
causes a leak as there is a ref-cycle between nsTimerImpl::mCallback and
DelayedRunnable::mTimer.

This patch adds nsIDelayedRunnableObserver for a target to observe which
DelayedRunnables are relying on their timer to run them. This allows the target
to schedule a shutdown task to cancel those timers and release the runnables on
the target thread.

Supported DelayedRunnable targets with this patch are TaskQueues,
eventqueue-based nsThreads and XPCOMThreadWrappers that wrap a supported
nsThread.

An assertion makes sure at runtime that future new uses of DelayedRunnable
target nsIDelayedRunnableObserver-supported event targets.

Differential Revision: https://phabricator.services.mozilla.com/D109781
2021-04-06 20:15:11 +00:00
Andreas Pehrson f600c8f2d3 Bug 1695580 - Simplify MozPromise code in nsThreadManager::Shutdown. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D109780
2021-04-06 20:15:10 +00:00
Andreas Pehrson a901c0f50a Bug 1695580 - Break out DelayedRunnable into its own files. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D109778
2021-04-06 20:15:09 +00:00
Brindusan Cristian 972d8621c6 Backed out 5 changesets (bug 1697585) for causing build bustages on nsTimerImpl.h. CLOSED TREE
Backed out changeset e9e4a710e7d1 (bug 1697585)
Backed out changeset bc271f42bcb7 (bug 1697585)
Backed out changeset d8516aec6a5e (bug 1697585)
Backed out changeset 0b1bc6cb84af (bug 1697585)
Backed out changeset 074ebebaee27 (bug 1697585)
2021-04-06 17:45:02 +03:00
Brindusan Cristian f78d18d827 Backed out 8 changesets (bug 1695580) for causing build bustages on DataMutex.h. CLOSED TREE
Backed out changeset ec0b0fcc8d88 (bug 1695580)
Backed out changeset 982a46056fcb (bug 1695580)
Backed out changeset e38e8b90f119 (bug 1695580)
Backed out changeset 6fdd154aa151 (bug 1695580)
Backed out changeset d04f7a7ec375 (bug 1695580)
Backed out changeset 2103cd9e58b7 (bug 1695580)
Backed out changeset de9a7dd7fc79 (bug 1695580)
Backed out changeset ae16f09be41b (bug 1695580)
2021-04-06 17:41:19 +03:00
Sean Feng 25b542e9e1 Bug 1697585 - Make input tasks can be more strictly aligned with Vsync r=smaug
This patch introduces a new way to way to schedule input tasks, such
that input tasks remain at `InputHigh` priority normally, however, when
there's a pending `Vsync` priority task in the task queue, we
increase the priority of input tasks from `InputHigh` to `InputHighest` to
rush processing the pending input tasks.

There are two restrictions to ensure we don't delay vsync too much:
  - There's a hard limit duration
  - We won't process the input tasks that are newly added after we've
    started to process the current number of input tasks

Differential Revision: https://phabricator.services.mozilla.com/D109499
2021-04-06 13:10:51 +00:00
Sean Feng e8574876c1 Bug 1697585 - Add VsyncTaskManager r=bas,smaug
Introduce a new TaskManager called VsyncTaskManager for
EventQueuePriority::Vsync tasks.

Differential Revision: https://phabricator.services.mozilla.com/D109498
2021-04-06 13:10:51 +00:00
Sean Feng dae8c27301 Bug 1697585 - Rename high priority to vsync priority r=smaug
`High` priority is being used for vsync tasks, so we should rename it to
make it clear, and renaming it also makes our priority naming less
confusing.

Differential Revision: https://phabricator.services.mozilla.com/D109536
2021-04-06 13:10:50 +00:00
Andreas Pehrson f9c6ad1082 Bug 1695580 - In xpcom, cancel pending DelayedRunnable timers on shutdown. r=KrisWright
Because DelayedRunnables are fire-and-forget, there is no way for a targeted
EventTarget to clean them up on shutdown. Thus if a timer fires after
EventTarget shutdown it will fail to dispatch the timer event, and avoid
releasing the timer callback because it's not on the targeted thread. This
causes a leak as there is a ref-cycle between nsTimerImpl::mCallback and
DelayedRunnable::mTimer.

This patch adds nsIDelayedRunnableObserver for a target to observe which
DelayedRunnables are relying on their timer to run them. This allows the target
to schedule a shutdown task to cancel those timers and release the runnables on
the target thread.

Supported DelayedRunnable targets with this patch are TaskQueues,
eventqueue-based nsThreads and XPCOMThreadWrappers that wrap a supported
nsThread.

An assertion makes sure at runtime that future new uses of DelayedRunnable
target nsIDelayedRunnableObserver-supported event targets.

Differential Revision: https://phabricator.services.mozilla.com/D109781
2021-04-06 12:16:11 +00:00
Andreas Pehrson 80e4501701 Bug 1695580 - Simplify MozPromise code in nsThreadManager::Shutdown. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D109780
2021-04-06 12:16:11 +00:00
Andreas Pehrson 25d202a7f3 Bug 1695580 - Break out DelayedRunnable into its own files. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D109778
2021-04-06 12:16:10 +00:00
Simon Giesecke cc730d05dd Bug 1184468 - Use nsTHashtable::Keys where possible. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D108588
2021-03-24 17:56:50 +00:00
Simon Giesecke 613e20d136 Bug 1184468 - Use nsBaseHashtable::Values. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D108587
2021-03-24 17:56:49 +00:00
Florian Quèze 8ad1e5d0aa Bug 1699742 - Remove MOZ_GECKO_PROFILER ifdefs that are no longer needed, r=gerald.
Differential Revision: https://phabricator.services.mozilla.com/D109078
2021-03-22 16:29:52 +00:00
Nika Layzell c733984c4b Bug 1675820 - Part 6: Make DocGroup cycle-collected, r=farre,smaug
Previously, the DocGroup type was not cycle-collected, as it needed to have
references from other threads for Quantum DOM. Nowadays the only off-main-thread
use of DocGroup is for dispatching runnables to the main thread which should be
tracked using a performance counter for about:performance. This means we can
remove the DocGroup references from these dispatching callsites, only storing
the Performance Counter we're interested in, and simplify make DocGroup be
cycle-collected itself.

This fixes a leak caused by adding the WindowGlobalChild getter to
WindowContext, by allowing cycles between the document and its BrowsingContext
to be broken by the cycle-collector.

Differential Revision: https://phabricator.services.mozilla.com/D108865
2021-03-18 19:24:50 +00:00
Jens Stutte 48b1ebeb71 Bug 1696397: Move SpinEventLoopUntilOrShutdown to -Quit and move the current shutdown state logic from nsThreadManager to AppShutdown; r=kmag,xpcom-reviewers
The SpinEventLoopUntilOrShutdown is interrupted in the main process only at stage "xpcom-shutdown", which is too late. In a content process instead we interrupt it early enough, at "content-child-will-shutdown".

This patch removes the current observer logic in nsThreadManager in favor of a current shutdown phase state machinery in AppShutdown and renames SpinEventLoopUntilOrShutdown to SpinEventLoopUntilOrQuit. It also ensures that SpinEventLoopUntilOrQuit breaks early (at "quit-application" in the main process).

For a further possible cleanup around shutdown state in child and parent process please refer to bug 1697745.

We have no automated test for this edge case, but we have diagnostic telemetry that will tell us if it helps.

Differential Revision: https://phabricator.services.mozilla.com/D107619
2021-03-17 08:07:48 +00:00
Bas Schouten 2e3c2b0fe4 Bug 1698191: Convert IdleTaskRunner to use the TaskController API directly. r=smaug,sfink
Differential Revision: https://phabricator.services.mozilla.com/D108272
2021-03-16 14:39:45 +00:00
Mike Hommey 85aac3e34e Bug 1698697 - Fix BlockingResourceBase code with callstack tracking enabled. r=nika
Since GetAcquisitionState is never used independently of
ClearAcquisitionState, we change it to TakeAcquisitionState, such that
we don't require an expensive array copy in this case.

Differential Revision: https://phabricator.services.mozilla.com/D108554
2021-03-16 05:18:10 +00:00
Steve Fink 6e36aed705 Bug 1692308 - Add an initial delay to IdleTaskRunner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D107504
2021-03-12 06:55:46 +00:00
Simon Giesecke ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Steve Fink de5993049e Bug 1696456 - Rename budget to minimumUsefulBudget in IdleTaskRunner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D107239
2021-03-08 16:27:43 +00:00
Florian Quèze dd2987078f Bug 1696406 - Nested event loops should be visible in the Firefox Profiler, r=nika.
Differential Revision: https://phabricator.services.mozilla.com/D107202
2021-03-04 21:24:10 +00:00
Florian Quèze b41e171c11 Bug 1694462 - Remove the nsIThreadManager.newThread API (newNamedThread should be used instead), r=bas,KrisWright.
Differential Revision: https://phabricator.services.mozilla.com/D106267
2021-03-02 22:34:51 +00:00
Jens Stutte 05581ddca4 Bug 1678330: Ensure nested SpinEventLoopUntil(OrShutdown) calls are traceable to the originating source in case of crash. r=nika,extension-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D106839
2021-03-02 22:11:58 +00:00
Cosmin Sabou b2eb620ed0 Backed out changeset 03cae7800b41 (bug 1678330) for mochitest plain failures on test_window_open_discarded_bc.html. CLOSED TREE 2021-03-02 20:18:21 +02:00
Jens Stutte a0af9ea0a4 Bug 1678330: Ensure nested SpinEventLoopUntil(OrShutdown) calls are traceable to the originating source in case of crash. r=nika,extension-reviewers
Differential Revision: https://phabricator.services.mozilla.com/D106839
2021-03-02 15:15:20 +00:00
Simon Giesecke 9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
Bas Schouten bbb0d338be Bug 1691517: Do not crash inside TaskController when the main thread is unavailable. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D105402
2021-02-18 03:53:29 +00:00
Gerald Squelart 96f3fabfcb Bug 1693037 - Fix non-MOZ_GECKO_PROFILER builds - r=florian
No code changes.

Build issues were found by renaming `MOZ_GECKO_PROFILER` to something else in toolkit/moz.configure, in both unified and non-unified builds, on all supported platforms.

Also updated some profiler-related comments.

Differential Revision: https://phabricator.services.mozilla.com/D105375
2021-02-17 22:36:28 +00:00
Simon Giesecke 661e25bf09 Bug 1692880 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-16 15:53:33 +00:00
Gerald Squelart 2416d881e2 Bug 1691589 - Reduce reliance on GeckoProfiler.h when only labels (and maybe markers) are needed - r=necko-reviewers,geckoview-reviewers,sg,agi,florian
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".

Differential Revision: https://phabricator.services.mozilla.com/D104588
2021-02-16 04:44:19 +00:00
smolnar 1afbbe67e1 Backed out 5 changesets (bug 1691894) for causing hazard failures in nsXULPrototypeCache. CLOSED TREE
Backed out changeset 22dc870ee609 (bug 1691894)
Backed out changeset 58c31e9d6ae3 (bug 1691894)
Backed out changeset 7483e84149d8 (bug 1691894)
Backed out changeset f977d6cfa973 (bug 1691894)
Backed out changeset db4503476f34 (bug 1691894)
2021-02-15 16:43:23 +02:00
Simon Giesecke 3c29a68440 Bug 1691894 - Make Put accept DataType instead of wrapping UserDataType. r=xpcom-reviewers,necko-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D104850
2021-02-15 10:04:46 +00:00
Simon Giesecke 8730386ad9 Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in xpcom. r=xpcom-reviewers,kmag
Differential Revision: https://phabricator.services.mozilla.com/D104195
2021-02-09 18:19:37 +00:00
Kershaw Chang 082d68bc40 Bug 1415923 - Ignore sleep and wake notifications on OSX r=xpcom-reviewers,KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D103228
2021-02-04 21:40:47 +00:00
Chris H-C b98fffa595 Bug 1688937 - Remove now-unused thread counting r=KrisWright
Depends on D103190

Differential Revision: https://phabricator.services.mozilla.com/D103191
2021-02-01 18:25:27 +00:00
Florian Quèze f447ef94de Bug 1688300 - Add 'Runnable' profiler markers showing when runnables are executed and a 'Task' label frame showing which tasks are started by TaskController, r=bas,gerald.
Differential Revision: https://phabricator.services.mozilla.com/D102803
2021-01-26 08:57:19 +00:00
Doug Thayer 8c0dd1bca6 Bug 1510226 - Do not block main thread in nsThread::Init r=froydnj,KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D41248
2021-01-25 21:44:15 +00:00
Tom Schuster 25bf0bbc2a Bug 1619947 - Make MozPromise::All work correctly with const r=bwc
Depends on D97854

Differential Revision: https://phabricator.services.mozilla.com/D102824
2021-01-25 15:34:29 +00:00
Bas Schouten c30efd3e32 Bug 1685727: Ensure all the thread pool task queue has been cleared before shutting down. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D102327
2021-01-19 19:36:29 +00:00
Bas Schouten f346ba1851 Bug 1686222: Ensure proper thread is woken up when a new task is posted. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D102324
2021-01-19 17:15:57 +00:00
Olli Pettay 2371718010 Bug 1685577 - Disable dom.input_events.canSuspendInBCG.enabled for now, r=sefeng
Differential Revision: https://phabricator.services.mozilla.com/D101051
2021-01-08 12:58:24 +00:00
Paul Bone 81d936b141 Bug 1683031 - pt 5. Add an assertion and document idle request IDs r=smaug
Add assertions and comments to explain the behaviour/use of the idle request
IDs.

Depends on D99330

Differential Revision: https://phabricator.services.mozilla.com/D100300
2020-12-22 17:56:46 +00:00
Kris Wright 89090895bb Bug 1683410 - Make sShutdownComplete atomic r=xpcom-reviewers,mccr8
This is changed on the main thread by `nsThreadManager` and should probably just be made atomic.

Differential Revision: https://phabricator.services.mozilla.com/D100161
2020-12-18 20:44:03 +00:00
Sean Feng 12424aa6b0 Bug 1662265 - Fix input events handling for sync XHR when both TaskController and e10s are enabled r=smaug
There are two issues in our current setup

1) Input events which are occurring in the same tab are going to be lost
because sync XHR. We have event handling suppression for synx XHR, so input
events are going to be discarded.

2) Input events that are happening in another tab (same process as the
synx XHR tab) are not going to be delayed. This is not correct since
sync XHR should block the Javascript execution.

This patches fixes the above cases for when both TaskController and e10s are
enabled by suspending the InputTaskManager during sync XHR, which
delays the input event handling and keeps the events around.

Differential Revision: https://phabricator.services.mozilla.com/D90780
2020-12-15 01:33:24 +00:00
Bas Schouten 23c25cd32a Bug 1675073: Manually set the stack size for TaskController pool threads. r=aosmond,smaug
Differential Revision: https://phabricator.services.mozilla.com/D99611
2020-12-14 01:07:59 +00:00
Simon Giesecke 7d166ee1a3 Bug 1680217 - Allow NewRunnableMethod to move in the this pointer from a RefPtr. r=xpcom-reviewers,KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D98440
2020-12-07 21:43:43 +00:00
Simon Giesecke 1c53236b70 Bug 1679272 - Include ScopeExit.h exactly where used. r=andi
Differential Revision: https://phabricator.services.mozilla.com/D98888
2020-12-07 14:25:59 +00:00
Karl Tomlinson d508bddd4f Bug 1119956 implement IdleRunnableWrapper::OnDiscard() r=sg
This causes no behavior changes in the current code because existing runnables
passed to NS_DispatchToThreadQueue() are either run on the main thread where
OnDiscard() is not called or they have only a no-op OnDiscard().

Differential Revision: https://phabricator.services.mozilla.com/D98120
2020-12-06 21:51:01 +00:00
Bas Schouten d7db260690 Bug 1680544 - Part 3: Do not log runnables coming from TaskController. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D98646
2020-12-04 18:59:45 +00:00