Commit Graph
61 Commits
Author SHA1 Message Date
Jens Stutte d6bfff4385 Bug 2045529 - Make the assertion+check less weird in IdleTaskRunner::ResetTimer. r=smaug
Replace the redundant MOZ_ASSERT + duplicate IsInOrBeyond check with a
cleaner if/else: call Cancel() in the shutdown case, and use
MOZ_ASSERT_UNREACHABLE in the impossible non-shutdown case.

Differential Revision: https://phabricator.services.mozilla.com/D305061
2026-06-07 17:52:08 +00:00
Jens Stutte 4840ebed28 Bug 2045418 - Cancel IdleTaskRunner on timer failure during shutdown. r=smaug
When timer creation fails in ResetTimer, mTimerActive stays false. The
IdleTaskRunnerTask previously added to the TaskController still fires,
calls Schedule(), sees !mTask, and enqueues another task — creating an
endless dispatch loop that prevents ShutdownXPCOM from draining the
event queue.

Fix by calling Cancel() when the timer fails and we are in or beyond
XPCOMShutdownThreads, which stops the runner from re-enqueuing itself.

Differential Revision: https://phabricator.services.mozilla.com/D305025
2026-06-06 10:42:50 +00:00
Jens Stutte 7f491ab69b Bug 2042402 - Fix IdleTaskRunner starvation when fallback timer fires with stale deadline. r=smaug
Promote TimedOut to a static member so it can clear mTimerActive before
calling Run(). This ties the flag strictly to the timer's lifecycle: set in
ResetTimer when the one-shot is armed, cleared in TimedOut when it fires.
Previously the else-if(now>=mDeadline) branch in Run() left mTimerActive==true
after the one-shot fired, causing SetTimerInternal to early-return and leaving
the runner with no wakeup source in environments where IdleTaskManager never
supplies an idle deadline (e.g. gtests).

Differential Revision: https://phabricator.services.mozilla.com/D303297
2026-05-29 19:06:28 +00:00
Sylvestre Ledru 6149f49299 Bug 2023419 - Remove Emacs/Vim modelines from xpcom/ r=emilio
replaced by .editorconfig
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D287878
2026-03-16 17:22:07 +00:00
Jens Stutte 1bfeb8b959 Bug 2005474 - Moot IdleTaskRunner assertion on shutdown. r=xpcom-reviewers,nika
Differential Revision: https://phabricator.services.mozilla.com/D283573
2026-02-23 06:23:46 +00:00
Jens Stutte 551ebf0dfb Bug 2001984 - Log IdleTaskRunner name on failing timer creation. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D273977
2025-11-25 12:49:43 +00:00
Jens Stutte 5a8db8a6f0 Bug 1985721 - Add assertions for successfull timer init. r=smaug
Timer initialization is fallible (in rare cases), but normally timers targeting the main thread should just work, modulo OOM crashes.

Differential Revision: https://phabricator.services.mozilla.com/D262918
2025-08-30 10:22:08 +00:00
Nika Layzell 7d39c30b5b Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-29 16:18:25 +00:00
iulian moraru f5d6849317 Revert "Bug 1979013: apply code formatting via Lando" for causing windows build bustages on MFTEncoder.cpp.
This reverts commit 8c929cc018.

Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"

This reverts commit e01c0a6a32.

Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"

This reverts commit 9f8e73c163.
2025-08-27 23:00:09 +00:00
Nika Layzell e01c0a6a32 Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.

It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).

Differential Revision: https://phabricator.services.mozilla.com/D261032
2025-08-27 22:04:15 +00:00
Olli Pettay eea8aec6c9 Bug 1868744 - If JS engine triggered a GC slice, don't trigger another too soon from CCGCScheduler, r=jonco
Differential Revision: https://phabricator.services.mozilla.com/D195755
2023-12-07 12:34:33 +00:00
Tooru Fujisawa 0b409e3235 Bug 1846407 - Use enum class for Task::Run return value. r=bas,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D185043
2023-10-18 15:23:29 +00:00
Noemi Erli fc342c9628 Backed out changeset 7718734e95b1 (bug 1846407) for causing bustages in nsWindow.cpp CLOSED TREE 2023-10-18 05:31:49 +03:00
Tooru Fujisawa bebceb1b21 Bug 1846407 - Use enum class for Task::Run return value. r=bas,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D185043
2023-10-18 01:54:43 +00:00
Cristian Tuns 457378e9e0 Backed out changeset a44ec30d604f (bug 1846407) for causing build bustages in ScriptLoader.cpp CLOSED TREE 2023-10-17 18:46:25 -04:00
Tooru Fujisawa 83e7121bc5 Bug 1846407 - Use enum class for Task::Run return value. r=bas,win-reviewers,rkraesig
Differential Revision: https://phabricator.services.mozilla.com/D185043
2023-10-17 22:16:58 +00:00
Emilio Cobos Álvarez d02e297b2d Bug 1624819 - Remove TaskCategory and other quantum dom remnants. r=smaug,media-playback-reviewers,credential-management-reviewers,cookie-reviewers,places-reviewers,win-reviewers,valentin,mhowell,sgalich,alwu
Sorry this is not a particularly easy patch to review. But it should be
mostly straight-forward.

I kept Document::Dispatch mostly for convenience, but could be
cleaned-up too / changed by SchedulerGroup::Dispatch. Similarly maybe
that can just be NS_DispatchToMainThread if we add an NS_IsMainThread
check there or something (to preserve shutdown semantics).

Differential Revision: https://phabricator.services.mozilla.com/D190450
2023-10-10 08:51:12 +00:00
Olli Pettay 0a311c4447 Bug 1856559 - Make IdleTaskRunner just dispatch an idle task when possible, r=bas
Differential Revision: https://phabricator.services.mozilla.com/D189914
2023-10-05 18:11:12 +00:00
Tooru Fujisawa 268184d652 Bug 1839102 - Use enum class for Task kind. r=bas
Differential Revision: https://phabricator.services.mozilla.com/D182980
2023-07-26 05:09:29 +00:00
Sandor Molnar 25031486a3 Backed out changeset b99cc4960043 (bug 1839102) for causing build bustages in idget/windows/nsWindow.cpp CLOSED TREE 2023-07-26 05:53:26 +03:00
Tooru Fujisawa 25becb8a76 Bug 1839102 - Use enum class for Task kind. r=bas
Differential Revision: https://phabricator.services.mozilla.com/D182980
2023-07-26 02:26:15 +00:00
serge-sans-paille 1f606e7dbc Bug 1774864 - Cleanup xpcom/ includes r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D149671
2022-06-24 07:13:59 +00:00
Olli Pettay b9786d5d3e Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-26 22:37:03 +00:00
criss 06f4fe1b55 Backed out changeset 39bd7bdd12be (bug 1754562) for causing multiple failures. CLOSED TREE 2022-02-25 13:40:50 +02:00
Olli Pettay e5d862393e Bug 1754562, make parent process' idle detection be aware of active RefreshDrivers in the other processes, r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D138504
2022-02-25 10:13:16 +00:00
Steve Fink e83c6b53a7 Bug 1672121 - Stop sGCRunner GC slice if the IdleTaskRunnerTask gets a RequestInterrupt() call r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D109631
2021-12-22 18:06:06 +00:00
Iulian Moraru 405d36ba49 Backed out 5 changesets (bug 1672121) for various crashes on mozalloc_handle_oom. CLOSED TREE
Backed out changeset 117756828ea7 (bug 1672121)
Backed out changeset 046e37035dbc (bug 1672121)
Backed out changeset de44a280103b (bug 1672121)
Backed out changeset 4acf4539a7b4 (bug 1672121)
Backed out changeset 8001b5433e38 (bug 1672121)
2021-11-30 02:59:20 +02:00
Steve Fink e8cd26f5ee Bug 1672121 - Stop sGCRunner GC slice if the IdleTaskRunnerTask gets a RequestInterrupt() call r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D109631
2021-11-29 19:59:52 +00:00
criss 17b8040dd3 Backed out 2 changesets (bug 1727960) by dev request
Backed out changeset 14abef8826d0 (bug 1727960)
Backed out changeset 2817b34b999e (bug 1727960)
2021-09-28 02:27:39 +03:00
Paul Bone 6cd1826aea Bug 1727960 - Use the start time of an idle task when nsRefreshDriver is ticking r=smaug,
Differential Revision: https://phabricator.services.mozilla.com/D123888
2021-09-02 01:17:28 +00:00
Paul Bone 4c54df65f3 Bug 1727960 - Properly detect if nsRefreshDriver is ticking in IdleTaskRunner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D123887
2021-09-02 01:17:27 +00:00
Paul Bone 4bde95962f Bug 1718184 - pt 1. IdleTaskRunner now uses TimeDuration r=nika
Differential Revision: https://phabricator.services.mozilla.com/D118791
2021-07-13 01:42:32 +00:00
Paul Bone 58add6dd74 Bug 1705320 - Fix some spelling errors r=mccr8 DONTBUILD
Differential Revision: https://phabricator.services.mozilla.com/D112155
2021-04-15 13:32:46 +00:00
Bas Schouten 63d8265487 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
Steve Fink 569f91b935 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
Steve Fink 41aea53b51 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
Steve Fink 1addad3cce Bug 1678416 - Minor comment fixes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D90901
2020-12-04 16:03:24 +00:00
Steve Fink 52f864b9c8 Bug 1678416 - Implement IdleTaskRunner::SetBudget() and add some comments. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D97670
2020-12-04 16:02:52 +00:00
Razvan Maries 528c4accb5 Backed out 5 changesets (bug 1678416) for build bustages on CCGCScheduler.h. CLOSED TREE
Backed out changeset cc5f7ecb3922 (bug 1678416)
Backed out changeset 61d9f960b80e (bug 1678416)
Backed out changeset 882f7ebe33fe (bug 1678416)
Backed out changeset e845a32a60bd (bug 1678416)
Backed out changeset 85f35f5749a0 (bug 1678416)
2020-12-04 04:55:39 +02:00
Steve Fink f7db20c6c0 Bug 1678416 - Minor comment fixes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D90901
2020-12-04 02:40:29 +00:00
Steve Fink e00e654139 Bug 1678416 - Implement IdleTaskRunner::SetBudget() and add some comments. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D97670
2020-12-04 02:40:00 +00:00
Karl Tomlinson 54446d9be0 Bug 1119956 introduce DiscardableRunnable for tasks that might not run but might not implement cancellation r=asuth,sg
Classes that inherit from DiscardableRunnable are only promising that it is OK
for Run() to be skipped, rather than promising that Cancel() is effective.

Differential Revision: https://phabricator.services.mozilla.com/D98117
2020-12-02 09:36:25 +00:00
Brindusan Cristian 4b189b50e8 Backed out changeset 16291a47acda (bug 1662254) for causing Bug 1677764. a=backout DONTBUILD 2020-11-19 21:43:10 +02:00
Steve Fink 0e7dbfc3b7 Bug 1662254 - Merge ICCRunner and CCRunner into a single CCRunner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D90633
2020-11-13 19:38:02 +00:00
Bogdan Tara a902379665 Backed out 10 changesets (bug 1662254) for lint failure on generate_static_pref_list.py CLOSED TREE
Backed out changeset 972e63387191 (bug 1662254)
Backed out changeset 3a9d6f0aa380 (bug 1662254)
Backed out changeset 4b3ffe7fe1af (bug 1662254)
Backed out changeset 4834b1025611 (bug 1662254)
Backed out changeset ec1f7afe8a2d (bug 1662254)
Backed out changeset c7a6b927b1de (bug 1662254)
Backed out changeset 2427d85b2605 (bug 1662254)
Backed out changeset 979bf4ac97bb (bug 1662254)
Backed out changeset 3e443333c636 (bug 1662254)
Backed out changeset a5261578ebfc (bug 1662254)
2020-11-12 23:59:07 +02:00
Steve Fink dc83dcff99 Bug 1662254 - Minor comment fixes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D90901
2020-11-12 19:05:08 +00:00
Steve Fink 9f1ec52ea3 Bug 1662254 - Merge ICCRunner and CCRunner into a single CCRunner r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D90633
2020-11-12 19:05:00 +00:00
Andreas Farre 4ca438fe5b Bug 1620594 - Part 3: Use default target for timers using SystemGroup. r=nika
Depends on D67632

Differential Revision: https://phabricator.services.mozilla.com/D67633
2020-04-07 15:16:46 +00:00
Olli Pettay 94d8b89f5c Bug 1515216, ensure IdleTaskRunners are added only once to RefreshDriver's idle runnable list, r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D27424
2019-04-15 15:41:15 +00:00
Randell Jesup 682721b83e Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd
* * *
Bug 1522150: Rename NS_IdleDispatch* functions since they take queue identifiers r=froyd
2019-01-26 12:18:05 -05:00