From 3f608fab0a107666ea48e2521dcb6bc5ae7c7f4e Mon Sep 17 00:00:00 2001 From: Doug Thayer Date: Fri, 22 Mar 2019 18:29:00 +0000 Subject: [PATCH] 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 needs to support the rvalue Write. Differential Revision: https://phabricator.services.mozilla.com/D23986 --HG-- extra : moz-landing-system : lando --- ipc/glue/IPDLParamTraits.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ipc/glue/IPDLParamTraits.h b/ipc/glue/IPDLParamTraits.h index a03414a453e6..f32615d1fe89 100644 --- a/ipc/glue/IPDLParamTraits.h +++ b/ipc/glue/IPDLParamTraits.h @@ -189,6 +189,16 @@ struct IPDLParamTraits> { } } + static void Write(IPC::Message* aMsg, IProtocol* aActor, + mozilla::Maybe&& 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, IProtocol* aActor, mozilla::Maybe* aResult) { bool isSome;