Bug 1441308 - Support moving Maybe's in IPC serialization r=mccr8

I'd like to move an ipc::ByteBuf member of a struct into a Maybe,
and in order for that to work IPDLParamTraits<Maybe> needs to support
the rvalue Write.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Doug Thayer 2019-03-22 18:29:00 +00:00
Родитель c734d845d0
Коммит 3f608fab0a
1 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -189,6 +189,16 @@ struct IPDLParamTraits<mozilla::Maybe<T>> {
} }
} }
static void Write(IPC::Message* aMsg, IProtocol* aActor,
mozilla::Maybe<T>&& aParam) {
bool isSome = aParam.isSome();
WriteIPDLParam(aMsg, aActor, isSome);
if (isSome) {
WriteIPDLParam(aMsg, aActor, std::move(aParam.ref()));
}
}
static bool Read(const IPC::Message* aMsg, PickleIterator* aIter, static bool Read(const IPC::Message* aMsg, PickleIterator* aIter,
IProtocol* aActor, mozilla::Maybe<T>* aResult) { IProtocol* aActor, mozilla::Maybe<T>* aResult) {
bool isSome; bool isSome;