Bug 1401111 - Use ContiguousEnumSerializer for EventMessage ParamTraits; r=botond
authorJulian Hector <julian.r.hector@gmail.com>
Fri, 01 Dec 2017 13:00:56 -0500
changeset 394586 ee0a6b975c1bd82e5dbb8d761c893c14164bcb8a
parent 394585 3bfd43a13286f2a7b1e929f592ffd94f59c392ed
child 394587 f848a44b286828352803a24db3688f3455fc5b81
push id33011
push usernerli@mozilla.com
push dateSat, 02 Dec 2017 21:41:32 +0000
treeherdermozilla-central@de1f7a92e872 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1401111
milestone59.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 1401111 - Use ContiguousEnumSerializer for EventMessage ParamTraits; r=botond
widget/nsGUIEventIPC.h
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -16,33 +16,21 @@
 #include "mozilla/TouchEvents.h"
 #include "mozilla/dom/Selection.h"
 #include "InputData.h"
 
 namespace IPC
 {
 
 template<>
-struct ParamTraits<mozilla::EventMessage>
-{
-  typedef mozilla::EventMessage paramType;
-
-  static void Write(Message* aMsg, const paramType& aParam)
-  {
-    WriteParam(aMsg, static_cast<const mozilla::EventMessageType&>(aParam));
-  }
-
-  static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
-  {
-    mozilla::EventMessageType eventMessage = 0;
-    bool ret = ReadParam(aMsg, aIter, &eventMessage);
-    *aResult = static_cast<paramType>(eventMessage);
-    return ret;
-  }
-};
+struct ParamTraits<mozilla::EventMessage> :
+  public ContiguousEnumSerializer<mozilla::EventMessage,
+                                  mozilla::EventMessage(0),
+                                  mozilla::EventMessage::eEventMessage_MaxValue>
+{};
 
 template<>
 struct ParamTraits<mozilla::BaseEventFlags>
 {
   typedef mozilla::BaseEventFlags paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {