Closed Bug 1646054 Opened 7 months ago Closed 7 months ago

Remove TaskQueue::EventTargetWrapper


(Core :: XPCOM, task)




Tracking Status
firefox79 --- fixed


(Reporter: jya, Assigned: jya)




(2 files)

TaskQueue is already a nsISerialEventTarget ; there's no need to wrap it in another nsISerialEventTarget.

I can't really tell what was behind the TaskQueue::EventTargetWrapper in the first place; other than preserving the nsIEventTarget::Dispatch's flags.

But that can be easily achieved without the need of a wrapper.

In bug 1602167; work was done to preserve the dispatch flags in the TaskQueue ;

however this would have had no effect as TaskQueue doesn't override the AbstractThread::Dispatch(already_AddRefed<nsIRunnable> event, uint32_t flags) method which will always drop the flags before calling Dispatch(already_AddRefed<nsIRunnable> aRunnable, DispatchReason aReason) [1]


The EventTargetWrapper would have properly preserved the flags, so we can simply move that Dispatch method in the taskqueue instead while we're at it.

See Also: → 1602167
Summary: Remove TaskQueue::EventTargetWrapper → Remove unused TaskQueue::EventTargetWrapper
Summary: Remove unused TaskQueue::EventTargetWrapper → Remove TaskQueue::EventTargetWrapper

We also establish the intent of bug 1602167 on the TaskQueue object

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

Pushed by
P1. Remove EventTargetWrapper class. r=froydnj
P2. Always retain dispatch flags r=froydnj
Closed: 7 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla79
You need to log in before you can comment on or make changes to this bug.