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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef GFX_VR_MANAGER_H
       7             : #define GFX_VR_MANAGER_H
       8             : 
       9             : #include "nsRefPtrHashtable.h"
      10             : #include "nsTArray.h"
      11             : #include "nsTHashtable.h"
      12             : #include "nsDataHashtable.h"
      13             : #include "mozilla/TimeStamp.h"
      14             : #include "gfxVR.h"
      15             : 
      16             : namespace mozilla {
      17             : namespace layers {
      18             : class TextureHost;
      19             : }
      20             : namespace gfx {
      21             : 
      22             : class VRLayerParent;
      23             : class VRManagerParent;
      24             : class VRDisplayHost;
      25             : 
      26             : class VRManager
      27             : {
      28           6 :   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(mozilla::gfx::VRManager)
      29             : 
      30             : public:
      31             :   static void ManagerInit();
      32             :   static VRManager* Get();
      33             : 
      34             :   void AddVRManagerParent(VRManagerParent* aVRManagerParent);
      35             :   void RemoveVRManagerParent(VRManagerParent* aVRManagerParent);
      36             : 
      37             :   void NotifyVsync(const TimeStamp& aVsyncTimestamp);
      38             :   void NotifyVRVsync(const uint32_t& aDisplayID);
      39             :   void RefreshVRDisplays(bool aMustDispatch = false);
      40             :   void ScanForControllers();
      41             :   void RemoveControllers();
      42             :   template<class T> void NotifyGamepadChange(const T& aInfo);
      43             :   RefPtr<gfx::VRDisplayHost> GetDisplay(const uint32_t& aDisplayID);
      44             :   void GetVRDisplayInfo(nsTArray<VRDisplayInfo>& aDisplayInfo);
      45             : 
      46             :   void SubmitFrame(VRLayerParent* aLayer, layers::PTextureParent* aTexture,
      47             :                    const gfx::Rect& aLeftEyeRect,
      48             :                    const gfx::Rect& aRightEyeRect);
      49             :   RefPtr<gfx::VRControllerHost> GetController(const uint32_t& aControllerID);
      50             :   void GetVRControllerInfo(nsTArray<VRControllerInfo>& aControllerInfo);
      51             :   void CreateVRTestSystem();
      52             :   void VibrateHaptic(uint32_t aControllerIdx, uint32_t aHapticIndex,
      53             :                      double aIntensity, double aDuration, uint32_t aPromiseID);
      54             :   void StopVibrateHaptic(uint32_t aControllerIdx);
      55             :   void NotifyVibrateHapticCompleted(uint32_t aPromiseID);
      56             :   void DispatchSubmitFrameResult(uint32_t aDisplayID, const VRSubmitFrameResultInfo& aResult);
      57             : 
      58             : protected:
      59             :   VRManager();
      60             :   ~VRManager();
      61             : 
      62             : private:
      63             :   RefPtr<layers::TextureHost> mLastFrame;
      64             : 
      65             :   void Init();
      66             :   void Destroy();
      67             :   void Shutdown();
      68             : 
      69             :   void DispatchVRDisplayInfoUpdate();
      70             :   void RefreshVRControllers();
      71             : 
      72             :   typedef nsTHashtable<nsRefPtrHashKey<VRManagerParent>> VRManagerParentSet;
      73             :   VRManagerParentSet mVRManagerParents;
      74             : 
      75             :   typedef nsTArray<RefPtr<VRSystemManager>> VRSystemManagerArray;
      76             :   VRSystemManagerArray mManagers;
      77             : 
      78             :   typedef nsRefPtrHashtable<nsUint32HashKey, gfx::VRDisplayHost> VRDisplayHostHashMap;
      79             :   VRDisplayHostHashMap mVRDisplays;
      80             : 
      81             :   typedef nsRefPtrHashtable<nsUint32HashKey, gfx::VRControllerHost> VRControllerHostHashMap;
      82             :   VRControllerHostHashMap mVRControllers;
      83             : 
      84             :   Atomic<bool> mInitialized;
      85             : 
      86             :   TimeStamp mLastRefreshTime;
      87             :   TimeStamp mLastActiveTime;
      88             :   bool mVRTestSystemCreated;
      89             : };
      90             : 
      91             : } // namespace gfx
      92             : } // namespace mozilla
      93             : 
      94             : #endif // GFX_VR_MANAGER_H

Generated by: LCOV version 1.13