Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/gfx/vr/VRDisplayClient.h
Line
Count
Source (jump to first uncovered line)
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/. */
6
7
#ifndef GFX_VR_DISPLAY_CLIENT_H
8
#define GFX_VR_DISPLAY_CLIENT_H
9
10
#include "nsIScreen.h"
11
#include "nsCOMPtr.h"
12
#include "mozilla/RefPtr.h"
13
#include "mozilla/dom/VRDisplayBinding.h"
14
15
#include "gfxVR.h"
16
17
namespace mozilla {
18
namespace gfx {
19
class VRDisplayPresentation;
20
class VRManagerChild;
21
22
class VRDisplayClient
23
{
24
public:
25
  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayClient)
26
27
  explicit VRDisplayClient(const VRDisplayInfo& aDisplayInfo);
28
29
  void UpdateDisplayInfo(const VRDisplayInfo& aDisplayInfo);
30
  void UpdateSubmitFrameResult(const VRSubmitFrameResultInfo& aResult);
31
32
0
  const VRDisplayInfo& GetDisplayInfo() const { return mDisplayInfo; }
33
  virtual VRHMDSensorState GetSensorState();
34
  void GetSubmitFrameResult(VRSubmitFrameResultInfo& aResult);
35
36
  virtual void ZeroSensor();
37
38
  already_AddRefed<VRDisplayPresentation> BeginPresentation(const nsTArray<dom::VRLayer>& aLayers,
39
                                                            uint32_t aGroup);
40
  void PresentationDestroyed();
41
42
  bool GetIsConnected() const;
43
44
  void NotifyDisconnected();
45
  void SetGroupMask(uint32_t aGroupMask);
46
47
  bool IsPresentationGenerationCurrent() const;
48
  void MakePresentationGenerationCurrent();
49
50
  void StartVRNavigation();
51
  void StopVRNavigation(const TimeDuration& aTimeout);
52
53
protected:
54
  virtual ~VRDisplayClient();
55
56
  void FireEvents();
57
  void FireGamepadEvents();
58
59
  VRDisplayInfo mDisplayInfo;
60
61
  bool bLastEventWasMounted;
62
  bool bLastEventWasPresenting;
63
64
  int mPresentationCount;
65
  uint64_t mLastEventFrameId;
66
  uint32_t mLastPresentingGeneration;
67
68
  // Difference between mDisplayInfo.mControllerState and mLastEventControllerState
69
  // determines what gamepad events to fire when updated.
70
  VRControllerState mLastEventControllerState[kVRControllerMaxCount];
71
private:
72
  VRSubmitFrameResultInfo mSubmitFrameResult;
73
};
74
75
} // namespace gfx
76
} // namespace mozilla
77
78
#endif /* GFX_VR_DISPLAY_CLIENT_H */