Open Bug 1588303 Opened 5 years ago Updated 2 years ago

Generated code for webidl dictionaries don't have move semantics

Categories

(Core :: DOM: Bindings (WebIDL), enhancement, P3)

enhancement

Tracking

()

People

(Reporter: bwc, Unassigned)

Details

For example, this type does not have a move constructor or assignment operator:

https://searchfox.org/mozilla-central/source/__GENERATED__/dist/include/mozilla/dom/RTCStatsReportBinding.h#765

We need to use this as a return type on an async ipdl interface here...

https://searchfox.org/mozilla-central/rev/c8933daeb71df02566407eff88904ee981a7bcdd/dom/media/webrtc/PMediaTransport.ipdl#91

...but we cannot, because the code generated for ipdl async return requires a move assignment operator to be defined for the type:

https://searchfox.org/mozilla-central/source/__GENERATED__/ipc/ipdl/PMediaTransportParent.cpp#1121-1122

This means that we need to do something pretty gross here:

https://searchfox.org/mozilla-central/rev/c8933daeb71df02566407eff88904ee981a7bcdd/dom/media/webrtc/WebrtcGlobal.h#19-31

And, we also need to write IPDL serializer/deserializer code for this abomination here:

https://searchfox.org/mozilla-central/rev/c8933daeb71df02566407eff88904ee981a7bcdd/dom/media/webrtc/WebrtcGlobal.h#71-84

It would be really nice to be able to get rid of this gross code, and it would also be pretty nice to have move semantics for performance reasons.

Type: defect → enhancement

Yeah, this would be nice, as long as it doesn't include codesize too much in lto builds (which would presumably be able to drop any unused move constructors).

It could be conditioned on the same things as the current copy constructor. Would probably need the addition of move constructors or move assignment operators to various things like dom::Optional.

Mentor: bzbarsky
Priority: -- → P3
Mentor: bzbarsky
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.