Closed Bug 1646054 Opened 7 months ago Closed 7 months ago

Remove TaskQueue::EventTargetWrapper

Categories

(Core :: XPCOM, task)

task

Tracking

()

RESOLVED FIXED
mozilla79
Tracking Status
firefox79 --- fixed

People

(Reporter: jya, Assigned: jya)

References

Details

Attachments

(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]

[1] https://searchfox.org/mozilla-central/rev/027893497316897b8f292bde48dbb6da2391a331/xpcom/threads/AbstractThread.cpp#236-240

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 jyavenard@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/ad3e3c470aec
P1. Remove EventTargetWrapper class. r=froydnj
https://hg.mozilla.org/integration/autoland/rev/d8c9e055d410
P2. Always retain dispatch flags r=froydnj
Status: NEW → RESOLVED
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.