Bug 1441308 - Support moving Maybe's in IPC serialization r=mccr8
☠☠ backed out by 699a6b6bee44 ☠ ☠
authorDoug Thayer <dothayer@mozilla.com>
Thu, 21 Mar 2019 23:15:32 +0000
changeset 465589 32f7793dfd1a
parent 465588 d8b4d6ec9b40
child 465590 1764701d11d1
push id81167
push userdothayer@mozilla.com
push dateFri, 22 Mar 2019 06:31:43 +0000
treeherderautoland@1764701d11d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1441308
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
ipc/glue/IPDLParamTraits.h
--- a/ipc/glue/IPDLParamTraits.h
+++ b/ipc/glue/IPDLParamTraits.h
@@ -184,16 +184,26 @@ struct IPDLParamTraits<mozilla::Maybe<T>
     bool isSome = aParam.isSome();
     WriteIPDLParam(aMsg, aActor, isSome);
 
     if (isSome) {
       WriteIPDLParam(aMsg, aActor, std::move(aParam.value()));
     }
   }
 
+  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,
                    IProtocol* aActor, mozilla::Maybe<T>* aResult) {
     bool isSome;
     if (!ReadIPDLParam(aMsg, aIter, aActor, &isSome)) {
       return false;
     }
 
     if (isSome) {