Bug 1383816 - Fixes several minor errors in Variant's IPC implementation. r?botond draft
authorJeff Hajewski <jeff.hajewski@gmail.com>
Sun, 03 Sep 2017 06:30:42 -0500
changeset 661706 69fd247df26427afe8921b4732f00ef663647221
parent 661689 ea7b55d65d76214f97aaae502d65cb26fc6f5659
child 661707 6ca1c580ddeaee6ed9ce039906aa1d5b02649357
push id78858
push userjeff.hajewski@gmail.com
push dateFri, 08 Sep 2017 22:55:28 +0000
reviewersbotond
bugs1383816
milestone57.0a1
Bug 1383816 - Fixes several minor errors in Variant's IPC implementation. r?botond * VariantWriter construction switched to use aggregate initialization * Call to AsVariant was inappropriately called via |paramType| when it should have been called via |mozilla| * |Next::Read| call in VariantReader specialization was missing the |result| argument MozReview-Commit-ID: Izany7iDX0k
ipc/glue/IPCMessageUtils.h
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -917,17 +917,17 @@ struct ParamTraits<mozilla::Variant<Ts..
     void match(const T& t) {
       WriteParam(msg, t);
     }
   };
 
   static void Write(Message* msg, const paramType& param)
   {
     WriteParam(msg, param.tag);
-    param.match(VariantWriter(msg));
+    param.match(VariantWriter{msg});
   }
 
   // Because VariantReader is a nested struct, we need the dummy template
   // parameter to avoid making VariantReader<0> an explicit specialization,
   // which is not allowed for a nested class template
   template<size_t N, typename dummy = void>
   struct VariantReader
   {
@@ -940,22 +940,22 @@ struct ParamTraits<mozilla::Variant<Ts..
       // subtract one to look at N - 1, the first valid tag.  This means our
       // comparisons are off by 1.  If we get to N = 0 then we have failed to
       // find a match to the tag.
       if (tag == N - 1) {
         // Recall, even though the template parameter is N, we are
         // actually interested in the N - 1 tag.
         typename mozilla::detail::Nth<N - 1, Ts...>::Type val;
         if (ReadParam(msg, iter, &val)) {
-          *result = paramType::AsVariant(val);
+          *result = mozilla::AsVariant(val);
           return true;
         }
         return false;
       } else {
-        return Next::Read(msg, iter, tag);
+        return Next::Read(msg, iter, tag, result);
       }
     }
 
   }; // VariantReader<N>
 
   // Since we are conditioning on tag = N - 1 in the preceding specialization,
   // if we get to `VariantReader<0, dummy>` we have failed to find
   // a matching tag.