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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * vim: sw=2 ts=8 et :
       3             :  */
       4             : /* This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #ifndef MOZILLA_GFX_VR_VRMANAGERPARENT_H
       9             : #define MOZILLA_GFX_VR_VRMANAGERPARENT_H
      10             : 
      11             : #include "mozilla/layers/CompositableTransactionParent.h"
      12             : #include "mozilla/layers/CompositorThread.h" // for CompositorThreadHolder
      13             : #include "mozilla/gfx/PVRManagerParent.h" // for PVRManagerParent
      14             : #include "mozilla/gfx/PVRLayerParent.h"   // for PVRLayerParent
      15             : #include "mozilla/ipc/ProtocolUtils.h"    // for IToplevelProtocol
      16             : #include "mozilla/TimeStamp.h"            // for TimeStamp
      17             : #include "gfxVR.h"                        // for VRFieldOfView
      18             : 
      19             : namespace mozilla {
      20             : using namespace layers;
      21             : namespace gfx {
      22             : 
      23             : class VRManager;
      24             : 
      25             : namespace impl {
      26             : class VRDisplayPuppet;
      27             : class VRControllerPuppet;
      28             : } // namespace impl
      29             : 
      30             : class VRManagerParent final : public PVRManagerParent
      31             :                             , public HostIPCAllocator
      32             :                             , public ShmemAllocator
      33             : {
      34             : public:
      35             :   explicit VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild);
      36             : 
      37             :   static VRManagerParent* CreateSameProcess();
      38             :   static bool CreateForGPUProcess(Endpoint<PVRManagerParent>&& aEndpoint);
      39             :   static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint);
      40             : 
      41             :   virtual base::ProcessId GetChildProcessId() override;
      42             : 
      43             :   // ShmemAllocator
      44             : 
      45           0 :   virtual ShmemAllocator* AsShmemAllocator() override { return this; }
      46             : 
      47             :   virtual bool AllocShmem(size_t aSize,
      48             :     ipc::SharedMemory::SharedMemoryType aType,
      49             :     ipc::Shmem* aShmem) override;
      50             : 
      51             :   virtual bool AllocUnsafeShmem(size_t aSize,
      52             :     ipc::SharedMemory::SharedMemoryType aType,
      53             :     ipc::Shmem* aShmem) override;
      54             : 
      55             :   virtual void DeallocShmem(ipc::Shmem& aShmem) override;
      56             : 
      57             :   virtual bool IsSameProcess() const override;
      58             :   bool HaveEventListener();
      59             :   bool HaveControllerListener();
      60             : 
      61             :   virtual void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override;
      62             :   virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
      63             :   bool SendGamepadUpdate(const GamepadChangeEvent& aGamepadEvent);
      64             :   bool SendReplyGamepadVibrateHaptic(const uint32_t& aPromiseID);
      65             : 
      66             : protected:
      67             :   ~VRManagerParent();
      68             : 
      69             :   virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,
      70             :                                               const LayersBackend& aLayersBackend,
      71             :                                               const TextureFlags& aFlags,
      72             :                                               const uint64_t& aSerial) override;
      73             :   virtual bool DeallocPTextureParent(PTextureParent* actor) override;
      74             : 
      75             :   virtual PVRLayerParent* AllocPVRLayerParent(const uint32_t& aDisplayID,
      76             :                                               const float& aLeftEyeX,
      77             :                                               const float& aLeftEyeY,
      78             :                                               const float& aLeftEyeWidth,
      79             :                                               const float& aLeftEyeHeight,
      80             :                                               const float& aRightEyeX,
      81             :                                               const float& aRightEyeY,
      82             :                                               const float& aRightEyeWidth,
      83             :                                               const float& aRightEyeHeight,
      84             :                                               const uint32_t& aGroup) override;
      85             :   virtual bool DeallocPVRLayerParent(PVRLayerParent* actor) override;
      86             : 
      87             :   virtual void ActorDestroy(ActorDestroyReason why) override;
      88             :   void OnChannelConnected(int32_t pid) override;
      89             : 
      90             :   virtual mozilla::ipc::IPCResult RecvRefreshDisplays() override;
      91             :   virtual mozilla::ipc::IPCResult RecvResetSensor(const uint32_t& aDisplayID) override;
      92             :   virtual mozilla::ipc::IPCResult RecvSetGroupMask(const uint32_t& aDisplayID, const uint32_t& aGroupMask) override;
      93             :   virtual mozilla::ipc::IPCResult RecvSetHaveEventListener(const bool& aHaveEventListener) override;
      94             :   virtual mozilla::ipc::IPCResult RecvControllerListenerAdded() override;
      95             :   virtual mozilla::ipc::IPCResult RecvControllerListenerRemoved() override;
      96             :   virtual mozilla::ipc::IPCResult RecvVibrateHaptic(const uint32_t& aControllerIdx, const uint32_t& aHapticIndex,
      97             :                                                     const double& aIntensity, const double& aDuration, const uint32_t& aPromiseID) override;
      98             :   virtual mozilla::ipc::IPCResult RecvStopVibrateHaptic(const uint32_t& aControllerIdx) override;
      99             :   virtual mozilla::ipc::IPCResult RecvCreateVRTestSystem() override;
     100             :   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestDisplay(const nsCString& aID, const uint32_t& aPromiseID) override;
     101             :   virtual mozilla::ipc::IPCResult RecvCreateVRServiceTestController(const nsCString& aID, const uint32_t& aPromiseID) override;
     102             :   virtual mozilla::ipc::IPCResult RecvSetDisplayInfoToMockDisplay(const uint32_t& aDeviceID,
     103             :                                                                   const VRDisplayInfo& aDisplayInfo) override;
     104             :   virtual mozilla::ipc::IPCResult RecvSetSensorStateToMockDisplay(const uint32_t& aDeviceID,
     105             :                                                                   const VRHMDSensorState& aSensorState) override;
     106             :   virtual mozilla::ipc::IPCResult RecvNewButtonEventToMockController(const uint32_t& aDeviceID, const long& aButton,
     107             :                                                                      const bool& aPressed) override;
     108             :   virtual mozilla::ipc::IPCResult RecvNewAxisMoveEventToMockController(const uint32_t& aDeviceID, const long& aAxis,
     109             :                                                                        const double& aValue) override;
     110             :   virtual mozilla::ipc::IPCResult RecvNewPoseMoveToMockController(const uint32_t& aDeviceID, const GamepadPoseState& pose) override;
     111             : 
     112             : private:
     113             :   void RegisterWithManager();
     114             :   void UnregisterFromManager();
     115             : 
     116             :   void Bind(Endpoint<PVRManagerParent>&& aEndpoint);
     117             : 
     118             :   static void RegisterVRManagerInCompositorThread(VRManagerParent* aVRManager);
     119             : 
     120             :   void DeferredDestroy();
     121             : 
     122             :   // This keeps us alive until ActorDestroy(), at which point we do a
     123             :   // deferred destruction of ourselves.
     124             :   RefPtr<VRManagerParent> mSelfRef;
     125             : 
     126             :   // Keep the compositor thread alive, until we have destroyed ourselves.
     127             :   RefPtr<layers::CompositorThreadHolder> mCompositorThreadHolder;
     128             : 
     129             :   // Keep the VRManager alive, until we have destroyed ourselves.
     130             :   RefPtr<VRManager> mVRManagerHolder;
     131             :   nsRefPtrHashtable<nsUint32HashKey, impl::VRDisplayPuppet> mVRDisplayTests;
     132             :   nsRefPtrHashtable<nsUint32HashKey, impl::VRControllerPuppet> mVRControllerTests;
     133             :   uint32_t mDisplayTestID;
     134             :   uint32_t mControllerTestID;
     135             :   bool mHaveEventListener;
     136             :   bool mHaveControllerListener;
     137             :   bool mIsContentChild;
     138             : };
     139             : 
     140             : } // namespace mozilla
     141             : } // namespace gfx
     142             : 
     143             : #endif // MOZILLA_GFX_VR_VRMANAGERPARENT_H

Generated by: LCOV version 1.13