LCOV - code coverage report
Current view: top level - dom/gamepad/ipc - GamepadMessageUtils.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 49 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 2 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : 
       2             : #ifndef mozilla_dom_gamepad_GamepadMessageUtils_h
       3             : #define mozilla_dom_gamepad_GamepadMessageUtils_h
       4             : 
       5             : #include "ipc/IPCMessageUtils.h"
       6             : #include "mozilla/dom/GamepadBinding.h"
       7             : #include "mozilla/dom/GamepadPoseState.h"
       8             : #include "mozilla/dom/GamepadServiceType.h"
       9             : 
      10             : namespace IPC {
      11             : 
      12             : template<>
      13             : struct ParamTraits<mozilla::dom::GamepadMappingType> :
      14             :   public ContiguousEnumSerializer<mozilla::dom::GamepadMappingType,
      15             :                                   mozilla::dom::GamepadMappingType(0),
      16             :                                   mozilla::dom::GamepadMappingType(
      17             :                                   mozilla::dom::GamepadMappingType::EndGuard_)> {};
      18             : 
      19             : template<>
      20             : struct ParamTraits<mozilla::dom::GamepadHand> :
      21             :   public ContiguousEnumSerializer<mozilla::dom::GamepadHand,
      22             :                                   mozilla::dom::GamepadHand(0),
      23             :                                   mozilla::dom::GamepadHand(
      24             :                                   mozilla::dom::GamepadHand::EndGuard_)> {};
      25             : 
      26             : template<>
      27             : struct ParamTraits<mozilla::dom::GamepadServiceType> :
      28             :   public ContiguousEnumSerializer<mozilla::dom::GamepadServiceType,
      29             :                                   mozilla::dom::GamepadServiceType(0),
      30             :                                   mozilla::dom::GamepadServiceType(
      31             :                                   mozilla::dom::GamepadServiceType::NumGamepadServiceType)> {};
      32             : 
      33             : template<>
      34             : struct ParamTraits<mozilla::dom::GamepadCapabilityFlags> :
      35             :   public BitFlagsEnumSerializer<mozilla::dom::GamepadCapabilityFlags,
      36             :                                 mozilla::dom::GamepadCapabilityFlags::Cap_All> {};
      37             : 
      38             : template <>
      39             : struct ParamTraits<mozilla::dom::GamepadPoseState>
      40             : {
      41             :   typedef mozilla::dom::GamepadPoseState paramType;
      42             : 
      43           0 :   static void Write(Message* aMsg, const paramType& aParam)
      44             :   {
      45           0 :     WriteParam(aMsg, aParam.flags);
      46           0 :     WriteParam(aMsg, aParam.orientation[0]);
      47           0 :     WriteParam(aMsg, aParam.orientation[1]);
      48           0 :     WriteParam(aMsg, aParam.orientation[2]);
      49           0 :     WriteParam(aMsg, aParam.orientation[3]);
      50           0 :     WriteParam(aMsg, aParam.position[0]);
      51           0 :     WriteParam(aMsg, aParam.position[1]);
      52           0 :     WriteParam(aMsg, aParam.position[2]);
      53           0 :     WriteParam(aMsg, aParam.angularVelocity[0]);
      54           0 :     WriteParam(aMsg, aParam.angularVelocity[1]);
      55           0 :     WriteParam(aMsg, aParam.angularVelocity[2]);
      56           0 :     WriteParam(aMsg, aParam.angularAcceleration[0]);
      57           0 :     WriteParam(aMsg, aParam.angularAcceleration[1]);
      58           0 :     WriteParam(aMsg, aParam.angularAcceleration[2]);
      59           0 :     WriteParam(aMsg, aParam.linearVelocity[0]);
      60           0 :     WriteParam(aMsg, aParam.linearVelocity[1]);
      61           0 :     WriteParam(aMsg, aParam.linearVelocity[2]);
      62           0 :     WriteParam(aMsg, aParam.linearAcceleration[0]);
      63           0 :     WriteParam(aMsg, aParam.linearAcceleration[1]);
      64           0 :     WriteParam(aMsg, aParam.linearAcceleration[2]);
      65           0 :     WriteParam(aMsg, aParam.isPositionValid);
      66           0 :     WriteParam(aMsg, aParam.isOrientationValid);
      67           0 :   }
      68             : 
      69           0 :   static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
      70             :   {
      71           0 :     if (!ReadParam(aMsg, aIter, &(aResult->flags)) ||
      72           0 :         !ReadParam(aMsg, aIter, &(aResult->orientation[0])) ||
      73           0 :         !ReadParam(aMsg, aIter, &(aResult->orientation[1])) ||
      74           0 :         !ReadParam(aMsg, aIter, &(aResult->orientation[2])) ||
      75           0 :         !ReadParam(aMsg, aIter, &(aResult->orientation[3])) ||
      76           0 :         !ReadParam(aMsg, aIter, &(aResult->position[0])) ||
      77           0 :         !ReadParam(aMsg, aIter, &(aResult->position[1])) ||
      78           0 :         !ReadParam(aMsg, aIter, &(aResult->position[2])) ||
      79           0 :         !ReadParam(aMsg, aIter, &(aResult->angularVelocity[0])) ||
      80           0 :         !ReadParam(aMsg, aIter, &(aResult->angularVelocity[1])) ||
      81           0 :         !ReadParam(aMsg, aIter, &(aResult->angularVelocity[2])) ||
      82           0 :         !ReadParam(aMsg, aIter, &(aResult->angularAcceleration[0])) ||
      83           0 :         !ReadParam(aMsg, aIter, &(aResult->angularAcceleration[1])) ||
      84           0 :         !ReadParam(aMsg, aIter, &(aResult->angularAcceleration[2])) ||
      85           0 :         !ReadParam(aMsg, aIter, &(aResult->linearVelocity[0])) ||
      86           0 :         !ReadParam(aMsg, aIter, &(aResult->linearVelocity[1])) ||
      87           0 :         !ReadParam(aMsg, aIter, &(aResult->linearVelocity[2])) ||
      88           0 :         !ReadParam(aMsg, aIter, &(aResult->linearAcceleration[0])) ||
      89           0 :         !ReadParam(aMsg, aIter, &(aResult->linearAcceleration[1])) ||
      90           0 :         !ReadParam(aMsg, aIter, &(aResult->linearAcceleration[2])) ||
      91           0 :         !ReadParam(aMsg, aIter, &(aResult->isPositionValid)) ||
      92           0 :         !ReadParam(aMsg, aIter, &(aResult->isOrientationValid))) {
      93           0 :       return false;
      94             :     }
      95           0 :     return true;
      96             :   }
      97             : };
      98             : 
      99             : } // namespace IPC
     100             : 
     101             : #endif // mozilla_dom_gamepad_GamepadMessageUtils_h

Generated by: LCOV version 1.13