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

2127 Коммитов

Автор SHA1 Сообщение Дата
Jean-Yves Avenard 498938c5ca Bug 1651249 - Dispatch to the current SerialEventTarget by default. r=froydnj
Dispatching to the underlying thread of what could be a thread-pool can lead to data-race as the code won't be run where you expect it to.

Differential Revision: https://phabricator.services.mozilla.com/D82632
2020-07-14 21:17:31 +00:00
Honza Bambas b3cbab1c49 Bug 1651068 - Include `Task` from `TaskController` in MOZ_LOG=events, r=bas
Differential Revision: https://phabricator.services.mozilla.com/D83065
2020-07-14 16:17:18 +00:00
Bas Schouten 43311c24a3 Bug 1650629: Correctly wait when requested and report whether work was done by ProcessNextEvent when using TaskController. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D83004
2020-07-09 23:41:15 +00:00
Perry Jiang 9c0f970552 Bug 1642906 - initialize PerformanceCounter in WorkerPrivate initialization r=dom-workers-and-storage-reviewers,sg
- Fixes a data race where the member variable is being written to by
EnsurePerformanceCounter on the worker thread while being read on a separate
thread (via Worker.postMessage).
- Apply some pointer guildelines to the member variable getters.
- Constify some things that should be const.

Differential Revision: https://phabricator.services.mozilla.com/D82475
2020-07-09 05:23:14 +00:00
Jean-Yves Avenard 8ebce5b5a8 Bug 1649671 - Add DelayedDispatch support to AbstractThread (and TaskQueue). r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81811
2020-07-02 00:08:54 +00:00
Simon Giesecke 61e4a0be9b Bug 1649729 - Get rid of MOZ_ACCESS_THREAD_BOUND macro. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81843
2020-07-01 13:13:23 +00:00
Simon Giesecke cd8b8939b9 Bug 1648010 - Replace uses of NS_LITERAL_STRING/NS_LITERAL_CSTRING macros by _ns literals. r=geckoview-reviewers,jgilbert,agi,hsivonen,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D80860
2020-07-01 08:29:29 +00:00
Bas Schouten 6323c24374 Bug 1606706 - Part 3: Enable new TaskController code by default. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D74673
2020-07-01 01:36:08 +00:00
Jean-Yves Avenard 4a24fe3c8e Bug 1647958 - P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Differential Revision: https://phabricator.services.mozilla.com/D80811
2020-06-30 08:04:10 +00:00
Honza Bambas e3c8fc6ab0 Bug 1648781 - MOZ_LOG of timer events dispatch and run, MOZ_LOG of idle-dispatch timeout, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D81467
2020-06-30 10:57:28 +00:00
Brindusan Cristian 6f757f82da Backed out 2 changesets (bug 1647958) for conflicting with the backout of Bug 1648898. CLOSED TREE
Backed out changeset 55ecb48a0504 (bug 1647958)
Backed out changeset af210e0df79f (bug 1647958)
2020-06-30 10:59:29 +03:00
Jean-Yves Avenard 35e8e946e1 Bug 1647958 - P3. Have GetCurrentSerialEventTarget returns the currently running MessageLoop. r=nika
We want it to returning the actual nsThread if that's where the MessageLoop would dispatch its tasks; otherwise return the MessageLoop's EventTarget

Depends on D80357

Differential Revision: https://phabricator.services.mozilla.com/D80811
2020-06-30 02:49:05 +00:00
Nihanth Subramanya 359cdd5536 Bug 1555557 - Do cert override file writes off the main thread. r=keeler
Differential Revision: https://phabricator.services.mozilla.com/D35375
2020-06-29 17:00:58 +00:00
Nathan Froyd d862df6fa7 Bug 1648787 - remove MOZ_GUARD_OBJECT bits from RecursiveMutex; r=dmajor,xpcom-reviewers,nika
Apparently I added these in the initial commit for RecursiveMutex.  I'm
not quite sure what I was thinking, but we don't need them for the
RecursiveMutex itself.  (We have them on the corresponding `*Auto*Lock`
classes, which are also `MOZ_RAII`.)

Differential Revision: https://phabricator.services.mozilla.com/D81345
2020-06-29 15:37:21 +00:00
Honza Bambas 2b6b893f89 Bug 1638925 - Ensure that the event gets destroyed within the guards r=jya
Differential Revision: https://phabricator.services.mozilla.com/D80171
2020-06-24 13:51:25 +00:00
Honza Bambas 2946f7e5b9 Bug 1638925 - Do not keep a raw pointer to an event in `LogTaskBase::Run` RAII class to avoid possible work with a released pointer, r=jya
Differential Revision: https://phabricator.services.mozilla.com/D80640
2020-06-24 13:51:23 +00:00
Honza Bambas 5c088661ed Bug 1638925 - Log IPC messages, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79621
2020-06-25 12:27:51 +00:00
Honza Bambas a81bb249b1 Bug 1638925 - Log names of nsINamed runnables, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79620
2020-06-24 13:49:44 +00:00
Honza Bambas 8ef571ccca Bug 1638925 - Log promise microtasks dispatch-and-run, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79618
2020-06-24 13:49:09 +00:00
Brindusan Cristian d41e442d47 Backed out 2 changesets (bug 1606706) for wpt leaks. CLOSED TREE
Backed out changeset 42b8f6456d16 (bug 1606706)
Backed out changeset 3fe0b4051541 (bug 1606706)
2020-06-25 14:53:30 +03:00
Bas Schouten f9399d1df7 Bug 1606706 - Part 3: Enable new TaskController code by default. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D74673
2020-06-25 08:04:01 +00:00
Jean-Yves Avenard 05a0f10af0 Bug 1637500 - P3. Have GetCurrentSerialEventTarget return running XPCOMThreadWrapper. r=froydnj
This will allow to remove AbstractThread::Current() as GetCurrentSerialEventTarget TLS value will be set whenever a task dispatched on the XPCOMThreadWrapper is run.

Differential Revision: https://phabricator.services.mozilla.com/D80355
2020-06-23 05:05:38 +00:00
Jean-Yves Avenard 87438519f0 Bug 1637500 - P2. Rename methods as they are not always dealing with "threads". r=froydnj
Before P1, GetCurrentThreadSerialEventTarget would have always returned the same data as NS_GetCurrentThread, making the comment incorrect Now it will properly return the running TaskQueue if any.

This change of name more clearly exposes what they are doing, as we aren't always dealing with threads directly; but a nsISerialEventTarget

Differential Revision: https://phabricator.services.mozilla.com/D80354
2020-06-23 05:05:36 +00:00
Jean-Yves Avenard 28c38fcc2b Bug 1637500 - P1. Have GetCurrentThreadSerialEventTarget returns the currently running TaskQueue if any. r=froydnj
In the future, we may want to extend GetCurrentThreadSerialEventTarget to return the actual nsISerialEventTarget used to dispatch the task.

Differential Revision: https://phabricator.services.mozilla.com/D80353
2020-06-23 05:02:39 +00:00
Jean-Yves Avenard 4e20dd6e65 Bug 1646054 - P2. Always retain dispatch flags r=froydnj
When TaskQueue was first conceived; it was only used with AbstractThreads and with tail dispatch.
By default, AbstractThread::Dispatch dropped the flags , as it was dispatching all tasks via the tail dispatcher.

It was an oversight, there's no use-case where we wouldn't want the dispatch flags to be carried forward.

It also simplifies the code and TaskQueue's use.

Depends on D80351

Differential Revision: https://phabricator.services.mozilla.com/D80352
2020-06-22 13:55:23 +00:00
Jean-Yves Avenard ea34205395 Bug 1646054 - P1. Remove EventTargetWrapper class. r=froydnj
We also establish the intent of bug 1602167 on the TaskQueue object

Differential Revision: https://phabricator.services.mozilla.com/D80351
2020-06-22 13:55:21 +00:00
David Major 2a6bf134e0 Bug 1646407 - Fix a snprintf complaint in nsTimerImpl.cpp r=njn
We have a clang-plugin check that wants to prefer `SprintfLiteral` over `snprintf`, but for some reason this wasn't caught before clang-11. I _think_ it has to do with previous versions not being able to see that `buflen` was constant, but I'm not really sure.

Differential Revision: https://phabricator.services.mozilla.com/D80021
2020-06-21 13:12:30 +00:00
Eric Rahm ba9b93f039 Bug 1646543 - Replace blacklist with more appropriate names. r=xpcom-reviewers,nika
This removes variants of "blacklist" from the xpcom directory. The preference name "network.file.path_blacklist" is left in place and will need a more thorough plan for removal. Instances of `MOZ_ASAN_BLACKLIST` remain as well and should be replaced in a larger modifcation of the `#define` in the mfbt component.

Differential Revision: https://phabricator.services.mozilla.com/D80098
2020-06-17 23:55:46 +00:00
Brindusan Cristian 35fe5d64b2 Backed out 4 changesets (bug 1638925) for build bustages at ipc_channel_posix.cc. CLOSED TREE
Backed out changeset e0fe5351fdf7 (bug 1638925)
Backed out changeset 2c8b67413cd6 (bug 1638925)
Backed out changeset 4ea2c9ceb540 (bug 1638925)
Backed out changeset 84236f1b9064 (bug 1638925)
2020-06-17 20:28:41 +03:00
Honza Bambas f2278bf3e2 Bug 1638925 - Log IPC messages, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79621
2020-06-17 16:15:06 +00:00
Honza Bambas 91ff5e401f Bug 1638925 - Log names of nsINamed runnables, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79620
2020-06-17 16:14:27 +00:00
Honza Bambas 828868b839 Bug 1638925 - Log promise microtasks dispatch-and-run, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79618
2020-06-17 16:13:51 +00:00
Simon Giesecke 298981065e Bug 1645339 - Use range-based for with nsTObserverArray in xpcom. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D79484
2020-06-15 08:55:27 +00:00
Jean-Yves Avenard d5528b6394 Bug 1641737 - P4. Add UseDirectTaskDispatch/UseSynchronousDispatch to MozPromiseHolder. r=bholley
The allows to not have to deal with MozPromise::Private directly.

Differential Revision: https://phabricator.services.mozilla.com/D78208
2020-06-12 05:56:39 +00:00
Jean-Yves Avenard 7b7d64db67 Bug 1641737 - P1. Set dispatch type to chained promises. r=bholley
When chaining a MozPromise set to be dispatched via the direct task queue (or synchronous), it makes sense for the chained promise to be dispatched in the same fashion.

All MozPromises generated by the IPC bindings are set to use the direct task queue in order to prevent the then runnable to run out of order with other IPC tasks.
We want to preserve that task ordering by default.

Differential Revision: https://phabricator.services.mozilla.com/D78178
2020-06-12 05:56:26 +00:00
Jean-Yves Avenard 4e41c1b386 Bug 1644009 - P14. Fallback to normal dispatch on release. r=bholley
We shouldn't ever get there, but just in case, better than a null deref.

Differential Revision: https://phabricator.services.mozilla.com/D79097
2020-06-12 05:10:57 +00:00
Jean-Yves Avenard a56b255f0f Bug 1644009 - P13. Don't have AutoTaskGuard inherit from AutoTaskDispatcher. r=bholley.
This prevent being able to assert in the AutoTaskDispatcher that we are using it from the right thread/taskqueue as the SimpleTaskQueue object isn't thread-safe.

We want to assert that all nsIDirectTaskDispatcher methods are only ever accessed on the underlying thread. To do so require that the scope of AutoTaskDispatcher to terminate prior the AutoTaskGuard one.

Differential Revision: https://phabricator.services.mozilla.com/D79096
2020-06-12 05:10:55 +00:00
Jean-Yves Avenard d846483194 Bug 1644009 - P10. Make MozPromise access direct task dispatcher using QI(nsIDirectTaskDispatcher). r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D79094
2020-06-12 05:10:32 +00:00
Jean-Yves Avenard 1e2af615c7 Bug 1644009 - P9. Add nsIDirectTaskDispatcher interface. r=froydnj
We extract the dealing of direct tasks from the TailDispatcher object and move into to the existing nsThread and TaskQueue classes.
TaskQueue is made to work with do_QueryInterface.

We continue accessing the direct tasks dispatcher via the TailDispatcher for now, which itself will forward the dealing of such tasks to the underlying thread.

Differential Revision: https://phabricator.services.mozilla.com/D79093
2020-06-12 05:10:25 +00:00
Jean-Yves Avenard 974a9641a4 Bug 1644009 - P8. Add SimpleTaskQueue object. r=froydnj
We will use it later for implementing direct task dispatching where required.

Differential Revision: https://phabricator.services.mozilla.com/D79092
2020-06-12 05:10:12 +00:00
Bas Schouten 45104a7a29 Bug 1644292: Duplicate code for runnable telemetry for runnables executed inside TaskController. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D78888
2020-06-09 13:02:37 +00:00
Bas Schouten c2dc5d2a40 Bug 1644288: Explicitly do not use timeDurationHelper when TaskController is enabled. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D78825
2020-06-09 12:42:24 +00:00
Razvan Maries caec984d54 Backed out 7 changesets (bug 1641737) assertion failures. CLOSED TREE
Backed out changeset 7f7b98339065 (bug 1641737)
Backed out changeset 32fba417ebd0 (bug 1641737)
Backed out changeset abd9cd77f3cb (bug 1641737)
Backed out changeset e3bf9a45db6a (bug 1641737)
Backed out changeset 94d47578009c (bug 1641737)
Backed out changeset 28bca5c5b8b4 (bug 1641737)
Backed out changeset 0296d0f6c1d1 (bug 1641737)
2020-06-09 18:55:08 +03:00
Jean-Yves Avenard bb29b401bc Bug 1641737 - P4. Add UseDirectTaskDispatch/UseSynchronousDispatch to MozPromiseHolder. r=bholley
The allows to not have to deal with MozPromise::Private directly.

Differential Revision: https://phabricator.services.mozilla.com/D78208
2020-06-09 07:23:57 +00:00
Jean-Yves Avenard 0e3faed81f Bug 1641737 - P1. Set dispatch type to chained promises. r=bholley
When chaining a MozPromise set to be dispatched via the direct task queue (or synchronous), it makes sense for the chained promise to be dispatched in the same fashion.

All MozPromises generated by the IPC bindings are set to use the direct task queue in order to prevent the then runnable to run out of order with other IPC tasks.
We want to preserve that task ordering by default.

Differential Revision: https://phabricator.services.mozilla.com/D78178
2020-06-09 07:23:29 +00:00
Dana Keeler ac4d01ea49 Bug 1644224 - make nsTimerEvent::sCanDeleteAllocator atomic/sequentially consistent r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78771
2020-06-08 19:59:40 +00:00
Simon Giesecke ebbc7ae838 Bug 1642989 - Use RemoveLastElements instead of RemoveElementsAt where possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78049
2020-06-08 08:50:15 +00:00
Simon Giesecke 13502cf27c Bug 1642991 - Use RemoveElementsBy where easily possible. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78055
2020-06-08 09:01:48 +00:00
Bas Schouten 8032d4373e Bug 1606706 - Part 2: Integrate new TaskController code into tree and allow usage by pref. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D74672
2020-06-04 00:02:18 +00:00
Bas Schouten c01e9666a7 Bug 1606706 - Part 1: Add new TaskController code to the tree. r=smaug,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D74671
2020-06-03 23:39:58 +00:00
Bogdan Tara 2719f07eb0 Backed out 2 changesets (bug 1606706) for talos tests timeouts CLOSED TREE
Backed out changeset ab3e1a067a71 (bug 1606706)
Backed out changeset c47cf57dab71 (bug 1606706)
2020-06-03 11:51:04 +03:00
Bas Schouten 3a3972c388 Bug 1606706 - Part 2: Integrate new TaskController code into tree and allow usage by pref. r=smaug,?
Differential Revision: https://phabricator.services.mozilla.com/D74672
2020-06-02 11:36:38 +00:00
Bas Schouten e79c5d94a5 Bug 1606706 - Part 1: Add new TaskController code to the tree. r=smaug,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D74671
2020-06-02 21:28:24 +00:00
Sylvestre Ledru 615c83d723 Bug 1519636 - Reformat recent changes to the Google coding style r=andi
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D76451
2020-05-25 07:42:38 +00:00
Nathan Froyd 1a536ec126 Bug 1639632 - convert xpcom/ to inherit from mozilla::Runnable where possible; r=KrisWright
A little less boilerplate is nice.

Differential Revision: https://phabricator.services.mozilla.com/D76178
2020-05-20 20:37:58 +00:00
Lina Cambridge 28cc6477f4 Bug 1638929 - Expose `NS_DispatchBackgroundTask` to `moz_task`. r=KrisWright
Differential Revision: https://phabricator.services.mozilla.com/D75838
2020-05-20 20:54:11 +00:00
Jean-Yves Avenard 906437cc5d Bug 1637890 - P3. Ensure an AbstractThread exists when dispatching a task. r=froydnj
When performing the last GC, remaining state watchers would dispatch direct tasks ; this was exposed with P3. Ensure this never happens.

Differential Revision: https://phabricator.services.mozilla.com/D75499
2020-05-18 02:30:27 +00:00
Jean-Yves Avenard de5872ee7a Bug 1637890 - P2. Don't use ClearOnShutdown to destroy AbstractThread::MainThread(). r=froydnj
During the last cycle collection, state watchers may attempt to dispatch tasks to the current AbstractThread, so we can't clear the TLS entry until that step has completed.

We want the object to be deleted last; ordering in call to ClearOnShutdown() can't guarantee it.

Differential Revision: https://phabricator.services.mozilla.com/D75498
2020-05-18 16:12:28 +00:00
Jean-Yves Avenard dfb2061bb1 Bug 1634264 - Reject MozPromise when DomPromiseListener is deleted. r=mattwoodrow
We remove the assertion that the error code was NS_OK, as users of FromDomPromise assert it must be a failure.

Differential Revision: https://phabricator.services.mozilla.com/D75737
2020-05-18 22:16:38 +00:00
Imanol Fernandez cee36f038b Bug 1636456 - Implement WebXR idle deadline detection r=kip,daoshengmu,smaug,rbarker
Gecko Idle detection relies heavily on RefreshDriver. GC/CC scheduling, including when to run GC or CC slices, and the length of the slices, is mostly based on idle time. As WebXR isn't using normal RefreshDriver, the content process thinks it's idle and GC and CC get basically up to 50 ms slices.

Not having WebXR idle detection is causing stutter frames during immersive presentation. This patch implements idle deadline hint and sets the correct GC slices budgets during WebXR presentation.

Differential Revision: https://phabricator.services.mozilla.com/D74426
2020-05-13 22:10:27 +00:00
Jean-Yves Avenard e574b42ad5 Bug 1592488 - P13. Add TailDispatchingTarget class. r=bholley
This wraps the current thread such that a call to Dispatch will be done as direct task dispatch instead so that the task will be run in the current event loop.
This allows for have similar (but not identical to) the microtask semantics of JS promises

Differential Revision: https://phabricator.services.mozilla.com/D69995
2020-05-12 10:45:23 +00:00
Jean-Yves Avenard ecf59bcb19 Bug 1592488 - P3. Update AbstractThread comment to reflect current mode of operation. r=mattwoodrow
Differential Revision: https://phabricator.services.mozilla.com/D74591
2020-05-12 10:42:52 +00:00
Jean-Yves Avenard ab7618f0d9 Bug 1592488 - P2. Add MozPromise::Private::UseDirectTaskDispatch. r=bholley
If set, the callback will be dispatched via a direct task.
Direct tasks are run via the current thread's tail dispatcher.
This mechanism is only available if both the caller and the target are on the same thread and an AbstractThread is available

Differential Revision: https://phabricator.services.mozilla.com/D71592
2020-05-12 10:42:44 +00:00
Jean-Yves Avenard 68431ed26f Bug 1592488 - P1. Add MozPromise::Private::UseSynchronousTaskDispatch. r=bholley
If set, the callback will be run synchronously when the promise is resolved or rejected.

Differential Revision: https://phabricator.services.mozilla.com/D71591
2020-05-12 10:53:48 +00:00
Honza Bambas 281f7b311b Bug 1634950 - Add event dispatch-and-run MOZ_LOG to our xpcom threads, r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73622
2020-05-12 12:48:49 +00:00
Jean-Yves Avenard 4f02149e61 Bug 1634253 - P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73823
2020-05-08 20:20:28 +00:00
Jean-Yves Avenard ee2897c234 Bug 1634253 - P3. Don't cause assertion when delay is 0. r=froydnj
already_AddRefed destructor assert that it's nullptr.
DelayedDispatch check that the value passed isn't 0 and return an error code, leaving the already_AddRefed untouched.

Differential Revision: https://phabricator.services.mozilla.com/D73821
2020-05-08 20:20:30 +00:00
Jean-Yves Avenard 0afd0b06c9 Bug 1634253 - P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj
This will allow to have other threads to use one such as the compositor thread.

Differential Revision: https://phabricator.services.mozilla.com/D73820
2020-05-08 20:20:32 +00:00
Jean-Yves Avenard dd75a6a8ab Bug 1634253 - P1. Fix constness. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73819
2020-05-08 20:20:35 +00:00
Narcis Beleuzu 58a833221c Backed out 9 changesets (bug 1634253) for bc failures on browser_bug295977_autoscroll_overflow.js . CLOSED TREE
Backed out changeset d41b75c1f7ec (bug 1634253)
Backed out changeset 5f8a1ee17b81 (bug 1634253)
Backed out changeset 43eda078b405 (bug 1634253)
Backed out changeset e98212a74709 (bug 1634253)
Backed out changeset 855e222ceb14 (bug 1634253)
Backed out changeset 9f01acdf4367 (bug 1634253)
Backed out changeset ea62cb1ec472 (bug 1634253)
Backed out changeset fa3e7588e7d6 (bug 1634253)
Backed out changeset 139e7035e736 (bug 1634253)
2020-05-08 23:09:31 +03:00
Jean-Yves Avenard f597eaee8b Bug 1634253 - P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73823
2020-05-07 08:04:34 +00:00
Jean-Yves Avenard efec5e2e85 Bug 1634253 - P3. Don't cause assertion when delay is 0. r=froydnj
already_AddRefed destructor assert that it's nullptr.
DelayedDispatch check that the value passed isn't 0 and return an error code, leaving the already_AddRefed untouched.

Differential Revision: https://phabricator.services.mozilla.com/D73821
2020-05-07 08:04:37 +00:00
Jean-Yves Avenard 3e533d2327 Bug 1634253 - P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj
This will allow to have other threads to use one such as the compositor thread.

Differential Revision: https://phabricator.services.mozilla.com/D73820
2020-05-07 08:04:39 +00:00
Jean-Yves Avenard 2494dc377e Bug 1634253 - P1. Fix constness. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73819
2020-05-07 08:04:41 +00:00
Mirko Brodesser 99d8db5e8a Bug 1635709: part 2) Add unit to `nsITimer`'s `init` methods. r=froydnj
`Selection`'s `nsAutoScrollTimer` uses it and it's clearer when the unit
is known.

Depends on D74051

Differential Revision: https://phabricator.services.mozilla.com/D74052
2020-05-06 15:23:22 +00:00
Dorel Luca 9340fa2b2d Backed out 11 changesets (bug 1635001, bug 1634253) for Browser-chrome failures in browser_bug295977_autoscroll_overflow.js
Backed out changeset c3c27cb46db6 (bug 1635001)
Backed out changeset 6cea251e5910 (bug 1635001)
Backed out changeset 3cb0a05be7fc (bug 1635001)
Backed out changeset 1cbb2866a3ad (bug 1634253)
Backed out changeset 53fd00dcf95c (bug 1634253)
Backed out changeset e3acd9db7065 (bug 1634253)
Backed out changeset 5c0b7aa99406 (bug 1634253)
Backed out changeset dc7e17f772be (bug 1634253)
Backed out changeset 6e47af64396a (bug 1634253)
Backed out changeset 8865de9ae0ef (bug 1634253)
Backed out changeset 6fac93b596c2 (bug 1634253)
2020-05-07 11:00:04 +03:00
Jean-Yves Avenard 19c4486bed Bug 1634253 - P4. Have NS_NewNamedThread take a already_Refed<nsIRunnable. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73823
2020-05-07 05:02:46 +00:00
Jean-Yves Avenard 50d25d73f4 Bug 1634253 - P3. Don't cause assertion when delay is 0. r=froydnj
already_AddRefed destructor assert that it's nullptr.
DelayedDispatch check that the value passed isn't 0 and return an error code, leaving the already_AddRefed untouched.

Differential Revision: https://phabricator.services.mozilla.com/D73821
2020-05-07 05:02:39 +00:00
Jean-Yves Avenard d792bf2e0c Bug 1634253 - P2. Dissociate running a BackgroundHangMonitor from main thread. r=froydnj
This will allow to have other threads to use one such as the compositor thread.

Differential Revision: https://phabricator.services.mozilla.com/D73820
2020-05-07 05:02:31 +00:00
Jean-Yves Avenard 151a0ccd4e Bug 1634253 - P1. Fix constness. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73819
2020-05-07 05:02:21 +00:00
Simon Giesecke 97d4011b9b Bug 1626570 - Improve handling of copying arrays in MozPromise. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D73641
2020-05-05 13:01:43 +00:00
Gerald Squelart 02d4f51396 Bug 1609907 - Add AUTO_PROFILER_THREAD_SLEEP around wait_for in DEBUG OffTheBooksCondVar::Wait - r=mstange
In non-DEBUG builds, `OffTheBooksCondVar::Wait` has `AUTO_PROFILER_THREAD_SLEEP`, but it's not in DEBUG builds.
`profiler_thread_sleep` does a `MOZ_ASSERT(mSleep == AWAKE)` in DEBUG builds, so the double call that happens in non-DEBUG wouldn't trigger the assertion!

This patch adds `AUTO_PROFILER_THREAD_SLEEP` in DEBUG `OffTheBooksCondVar::Wait`, to catch more misuses during development.

Depends on D72851

Differential Revision: https://phabricator.services.mozilla.com/D72852
2020-05-01 22:12:56 +00:00
Gerald Squelart 6f36a3fdb8 Bug 1609907 - Remove AUTO_PROFILER_THREAD_SLEEP before mozilla::CondVar waits - r=mstange
CondVar already calls `AUTO_PROFILER_THREAD_SLEEP`, which shouldn't be called recursively.

mozilla::Monitor also uses CondVar, so it shouldn't be surrounded by `AUTO_PROFILER_THREAD_SLEEP` either.

Depends on D72850

Differential Revision: https://phabricator.services.mozilla.com/D72851
2020-05-01 22:12:22 +00:00
Bobby Holley 6e85e332ad Bug 1631304 - Use thread observers for the tail dispatcher. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D71710
2020-04-28 21:18:24 +00:00
Bobby Holley 216d17b976 Bug 1631304 - Mark the tail dispatcher as unavailable outside of event dispatch. r=jya
This is in preparation for running the tail dispatcher off
nsIThreadObserver callbacks, which only work during regular
event processing.

Differential Revision: https://phabricator.services.mozilla.com/D72264
2020-04-28 21:18:21 +00:00
Bobby Holley d90069e220 Bug 1631304 - Reject AbstractThread dispatches after the main thread has ceased event proccessing. r=erahm
Differential Revision: https://phabricator.services.mozilla.com/D72263
2020-04-28 21:18:19 +00:00
Bobby Holley a50600019a Bug 1631304 - Replace EventTargetWrapper with XPCOMThreadWrapper. r=jya
This is how it used to be, before the Quantum DOM stuff. We use
nsIThreadInternal because that supports thread observers, which we
leverage in the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D71709
2020-04-28 21:18:17 +00:00
Bobby Holley b5422991d2 Bug 1631304 - Don't lazily create a TailDispatcher from MaybeDrainDirectTasks. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D72262
2020-04-28 21:18:15 +00:00
Bobby Holley b90c44273e Bug 1631304 - Drill a fast path to accessing the main thread. r=erahm
I'm surprised we don't have this already.

Differential Revision: https://phabricator.services.mozilla.com/D71486
2020-04-28 21:18:10 +00:00
Sylvestre Ledru 34acbb653a Bug 1619165 - Reformat recent changes to the Google coding style r=andi
First reformat with clang-format 10

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D68802
2020-04-25 09:40:08 +00:00
Jean-Yves Avenard 6fa1bb5971 Bug 1630802 - P9. EventTargetWrapper runners don't need to be cancellable. r=bholley
It was required once upon a time to be able to use MozPromise on Workers.
Today a MozPromise work with nsISerialEventTarget and no longer rely on this. It can go.

Differential Revision: https://phabricator.services.mozilla.com/D71442
2020-04-20 02:08:23 +00:00
Jean-Yves Avenard d882415a98 Bug 1630802 - P8. Remove unnecessary AutoEnter. r=bholley
AutoEnter was an attempt around a race between AbstractThread and MessageLoopAbstractThreadWrap that would cause AbstractThread::GetCurrent() to return an incorrect value. MessageLoopAbstractThreadWrapper is no more and as such AutoEnter is no longer required.

Differential Revision: https://phabricator.services.mozilla.com/D71279
2020-04-20 02:13:31 +00:00
Jean-Yves Avenard f739ba2873 Bug 1630802 - P7. Remove CreateEventTargetWrapper and ensure that only a single AbstractThread exists par nsIThread. r=bholley
Differential Revision: https://phabricator.services.mozilla.com/D71492
2020-04-21 03:02:39 +00:00
Jean-Yves Avenard 61ac17fa16 Bug 1630802 - P3. Make AbstractThread::GetCurrent() return MainThread on the main thread. r=bholley
prior bug 1364821, AbstractThread::GetCurrent() would always return AbstractThread::MainThread() when called from the main thread.
After this change, we had to run within an AutoEnter scope.

A hidden side effect of this change was that under most cases AbstractThread::MainThread::Dispatch() would no longer use the tail dispatcher to dispatch a task.

It can be safely assume that whenever you're on the main thread, the equivalent AbstractThread is usable.

In the next commit, we will be removing AutoEnter entirely.

Differential Revision: https://phabricator.services.mozilla.com/D71148
2020-04-20 02:07:10 +00:00
Jean-Yves Avenard 08cdd889a1 Bug 1630802 - P1. Cleanup AbstractThread TLS lookup. r=gerald
Differential Revision: https://phabricator.services.mozilla.com/D69994
2020-04-20 02:06:51 +00:00
Ciure Andrei 82b75f7098 Backed out 3 changesets (bug 1631304) for causing MediaStream-MediaElement-srcObject.https.html wpt failures CLOSED TREE
Backed out changeset 54e27b897b3a (bug 1631304)
Backed out changeset 9ffa1843a04b (bug 1631304)
Backed out changeset 700adf5d3779 (bug 1631304)
2020-04-21 04:25:48 +03:00
Bobby Holley db090baf2a Bug 1631304 - Run the TailDispatcher off the Microtask queue. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D71488
2020-04-20 19:12:43 +00:00
Bobby Holley a15d363d2d Bug 1631304 - Add a mechanism to dispatch runnables as microtasks. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D71487
2020-04-20 20:39:46 +00:00
Bobby Holley 67208f946c Bug 1631304 - Drill a fast path to accessing the main thread. r=erahm
I'm surprised we don't have this already.

Differential Revision: https://phabricator.services.mozilla.com/D71486
2020-04-20 22:49:39 +00:00
Olli Pettay ebe2702267 Bug 1627935 - PrioritizedEventQueue::GetEvent doesn't return the correct priority value, r=bas
One could possibly make larger changes to make the setup less error prone, but hopefully we'll
replace this code with the new scheduler relatively soon.
And the assertion there should still enforce correct behavior.

Differential Revision: https://phabricator.services.mozilla.com/D69988

--HG--
extra : moz-landing-system : lando
2020-04-13 22:22:57 +00:00