Closed Bug 2011597 Opened 9 months ago Closed 8 months ago

Allow move-only types in UnboundedMPSCQueue

Categories

(Core :: Audio/Video: MediaStreamGraph, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
150 Branch
Tracking Status
firefox150 --- fixed

People

(Reporter: jari, Assigned: jari)

References

(Blocks 1 open bug)

Details

Attachments

(2 external files)

The file dom/media/UnboundedMessageQueue.h contains one of the multiple producers, single consumer queue implementations in Gecko. It is generic so that technically it could be widely used but unfortunately it requires the data type to be copyable.

If the assignment of the data to the output value on pop were changed to use std::move then the queue could also be used for move-only types, and we could avoid the proliferation of MPSC queues without fundamental differences.

Seems like not much is breaking if we just use move. The comment right after the change says that the data of next would have been stale anyways so why not avoid the copy? A possible downside is that T would need a move assignment operator, and while not having one is often a circumstance of historical or unintentional origin, for the cases where copy is truly needed, there could be an assignment-performing wrapper which by default does a move and for the specific overloads does the copy.

Blocks: 1903530
Assignee: nobody → jjalkanen
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 150 Branch
QA Whiteboard: [qa-triage-done-c151/b150]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: