Bug 1567650 [wpt PR 17950] - [ElementTiming] Replace responseEnd with loadTime, a...
[gecko.git] / gfx / vr / VRDisplayClient.h
blob279e0b06826dc0fa2333b04d5efa1c21b67e7d24
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef GFX_VR_DISPLAY_CLIENT_H
8 #define GFX_VR_DISPLAY_CLIENT_H
10 #include "nsIScreen.h"
11 #include "nsCOMPtr.h"
12 #include "mozilla/Attributes.h"
13 #include "mozilla/RefPtr.h"
14 #include "mozilla/dom/VRDisplayBinding.h"
16 #include "gfxVR.h"
18 namespace mozilla {
19 namespace gfx {
20 class VRDisplayPresentation;
21 class VRManagerChild;
23 class VRDisplayClient {
24 public:
25 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient)
27 explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo);
29 MOZ_CAN_RUN_SCRIPT void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo);
30 void UpdateSubmitFrameResult(const VRSubmitFrameResultInfo& aResult);
32 const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
33 virtual const VRHMDSensorState& GetSensorState() const;
34 void GetSubmitFrameResult(VRSubmitFrameResultInfo& aResult);
36 already_AddRefed<VRDisplayPresentation> BeginPresentation(
37 const nsTArray<dom::VRLayer>& aLayers, uint32_t aGroup);
38 void PresentationDestroyed();
40 bool GetIsConnected() const;
42 void NotifyDisconnected();
43 void SetGroupMask(uint32_t aGroupMask);
45 bool IsPresentationGenerationCurrent() const;
46 void MakePresentationGenerationCurrent();
48 void StartVRNavigation();
49 void StopVRNavigation(const TimeDuration& aTimeout);
51 protected:
52 virtual ~VRDisplayClient();
54 MOZ_CAN_RUN_SCRIPT void FireEvents();
55 void FireGamepadEvents();
57 VRDisplayInfo mDisplayInfo;
59 bool bLastEventWasMounted;
60 bool bLastEventWasPresenting;
62 int mPresentationCount;
63 uint64_t mLastEventFrameId;
64 uint32_t mLastPresentingGeneration;
66 // Difference between mDisplayInfo.mControllerState and
67 // mLastEventControllerState determines what gamepad events to fire when
68 // updated.
69 VRControllerState mLastEventControllerState[kVRControllerMaxCount];
71 private:
72 VRSubmitFrameResultInfo mSubmitFrameResult;
75 } // namespace gfx
76 } // namespace mozilla
78 #endif /* GFX_VR_DISPLAY_CLIENT_H */