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_DISPLAY_CLIENT_H
7 : #define GFX_VR_DISPLAY_CLIENT_H
8 :
9 : #include "nsIScreen.h"
10 : #include "nsCOMPtr.h"
11 : #include "mozilla/RefPtr.h"
12 : #include "mozilla/dom/VRDisplayBinding.h"
13 :
14 : #include "gfxVR.h"
15 :
16 : namespace mozilla {
17 : namespace gfx {
18 : class VRDisplayPresentation;
19 : class VRManagerChild;
20 :
21 : class VRDisplayClient
22 : {
23 : public:
24 0 : NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient)
25 :
26 : explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo);
27 :
28 : void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo);
29 : void UpdateSubmitFrameResult(const VRSubmitFrameResultInfo& aResult);
30 :
31 0 : const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
32 : virtual VRHMDSensorState GetSensorState();
33 : void GetSubmitFrameResult(VRSubmitFrameResultInfo& aResult);
34 :
35 : virtual void ZeroSensor();
36 :
37 : already_AddRefed<VRDisplayPresentation> BeginPresentation(const nsTArray<dom::VRLayer>& aLayers,
38 : uint32_t aGroup);
39 : void PresentationDestroyed();
40 :
41 : bool GetIsConnected() const;
42 :
43 : void NotifyDisconnected();
44 : void SetGroupMask(uint32_t aGroupMask);
45 :
46 : protected:
47 : virtual ~VRDisplayClient();
48 :
49 : void FireEvents();
50 :
51 : VRDisplayInfo mDisplayInfo;
52 :
53 : bool bLastEventWasMounted;
54 : bool bLastEventWasPresenting;
55 :
56 : int mPresentationCount;
57 : uint32_t mLastEventFrameId;
58 : private:
59 : VRSubmitFrameResultInfo mSubmitFrameResult;
60 : };
61 :
62 : } // namespace gfx
63 : } // namespace mozilla
64 :
65 : #endif /* GFX_VR_DISPLAY_CLIENT_H */
|