Bug 1250244 - Part 5: Rename VRDevice to VRDisplay,r=bz

- In order to reduce the size of the following patches
  and increase their readability, we rename VRDevice
  to VRDisplay here first.

MozReview-Commit-ID: 3pv8scdIi5w
This commit is contained in:
Kearwood (Kip) Gilbert 2016-04-12 17:39:28 -07:00
Родитель 20e3431c17
Коммит 0fa828c884
28 изменённых файлов: 217 добавлений и 217 удалений

Просмотреть файл

@ -143,7 +143,7 @@
#include "mozilla/dom/KeyframeEffectBinding.h"
#include "mozilla/dom/WindowBinding.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/VRDevice.h"
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
#include "nsComputedDOMStyle.h"

Просмотреть файл

@ -51,7 +51,7 @@
#include "mozilla/dom/Telephony.h"
#include "mozilla/dom/Voicemail.h"
#include "mozilla/dom/TVManager.h"
#include "mozilla/dom/VRDevice.h"
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/dom/workers/RuntimeService.h"
#include "mozilla/Hal.h"
#include "nsISiteSpecificUserAgent.h"
@ -267,7 +267,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(Navigator)
#ifdef MOZ_GAMEPAD
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGamepadServiceTest)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRGetDevicesPromises)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRGetDisplaysPromises)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@ -412,7 +412,7 @@ Navigator::Invalidate()
}
#endif
mVRGetDevicesPromises.Clear();
mVRGetDisplaysPromises.Clear();
}
//*****************************************************************************
@ -2037,7 +2037,7 @@ Navigator::RequestGamepadServiceTest()
#endif
already_AddRefed<Promise>
Navigator::GetVRDevices(ErrorResult& aRv)
Navigator::GetVRDisplays(ErrorResult& aRv)
{
if (!mWindow || !mWindow->GetDocShell()) {
aRv.Throw(NS_ERROR_UNEXPECTED);
@ -2050,35 +2050,35 @@ Navigator::GetVRDevices(ErrorResult& aRv)
return nullptr;
}
// We pass ourself to RefreshVRDevices, so NotifyVRDevicesUpdated will
// be called asynchronously, resolving the promises in mVRGetDevicesPromises.
if (!VRDevice::RefreshVRDevices(this)) {
// We pass ourself to RefreshVRDisplays, so NotifyVRDisplaysUpdated will
// be called asynchronously, resolving the promises in mVRGetDisplaysPromises.
if (!VRDisplay::RefreshVRDisplays(this)) {
p->MaybeReject(NS_ERROR_FAILURE);
return p.forget();
}
mVRGetDevicesPromises.AppendElement(p);
mVRGetDisplaysPromises.AppendElement(p);
return p.forget();
}
void
Navigator::NotifyVRDevicesUpdated()
Navigator::NotifyVRDisplaysUpdated()
{
// Synchronize the VR devices and resolve the promises in
// mVRGetDevicesPromises
// mVRGetDisplaysPromises
nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow);
nsTArray<RefPtr<VRDevice>> vrDevs;
if (win->UpdateVRDevices(vrDevs)) {
for (auto p: mVRGetDevicesPromises) {
p->MaybeResolve(vrDevs);
nsTArray<RefPtr<VRDisplay>> vrDisplays;
if (win->UpdateVRDisplays(vrDisplays)) {
for (auto p : mVRGetDisplaysPromises) {
p->MaybeResolve(vrDisplays);
}
} else {
for (auto p: mVRGetDevicesPromises) {
for (auto p : mVRGetDisplaysPromises) {
p->MaybeReject(NS_ERROR_FAILURE);
}
}
mVRGetDevicesPromises.Clear();
mVRGetDisplaysPromises.Clear();
}
//*****************************************************************************

Просмотреть файл

@ -260,8 +260,8 @@ public:
void GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
GamepadServiceTest* RequestGamepadServiceTest();
#endif // MOZ_GAMEPAD
already_AddRefed<Promise> GetVRDevices(ErrorResult& aRv);
void NotifyVRDevicesUpdated();
already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
void NotifyVRDisplaysUpdated();
#ifdef MOZ_B2G_FM
FMRadio* GetMozFMRadio(ErrorResult& aRv);
#endif
@ -394,7 +394,7 @@ private:
#ifdef MOZ_GAMEPAD
RefPtr<GamepadServiceTest> mGamepadServiceTest;
#endif
nsTArray<RefPtr<Promise> > mVRGetDevicesPromises;
nsTArray<RefPtr<Promise> > mVRGetDisplaysPromises;
nsTArray<uint32_t> mRequestedVibrationPattern;
};

Просмотреть файл

@ -259,7 +259,7 @@
#include "IPeerConnection.h"
#endif // MOZ_WEBRTC
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
using namespace mozilla;
using namespace mozilla::dom;

Просмотреть файл

@ -192,7 +192,7 @@
#include "mozilla/dom/GamepadManager.h"
#endif
#include "mozilla/dom/VRDevice.h"
#include "mozilla/dom/VRDisplay.h"
#include "nsRefreshDriver.h"
#include "Layers.h"
@ -1891,7 +1891,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRDevices)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVRDisplays)
// Traverse stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeEventHandler)
@ -1967,7 +1967,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
#endif
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCacheStorage)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVRDevices)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mVRDisplays)
// Unlink stuff from nsPIDOMWindow
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeEventHandler)
@ -13351,12 +13351,12 @@ nsGlobalWindow::SyncGamepadState()
#endif // MOZ_GAMEPAD
bool
nsGlobalWindow::UpdateVRDevices(nsTArray<RefPtr<mozilla::dom::VRDevice>>& aDevices)
nsGlobalWindow::UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDevices)
{
FORWARD_TO_INNER(UpdateVRDevices, (aDevices), false);
FORWARD_TO_INNER(UpdateVRDisplays, (aDevices), false);
VRDevice::UpdateVRDevices(mVRDevices, ToSupports(this));
aDevices = mVRDevices;
VRDisplay::UpdateVRDisplays(mVRDisplays, ToSupports(this));
aDevices = mVRDisplays;
return true;
}

Просмотреть файл

@ -122,7 +122,7 @@ class RequestOrUSVString;
class Selection;
class SpeechSynthesis;
class U2F;
class VRDevice;
class VRDisplay;
class WakeLock;
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
class WindowOrientationObserver;
@ -801,8 +801,8 @@ public:
void EnableGamepadUpdates();
void DisableGamepadUpdates();
// Update the VR devices for this window
bool UpdateVRDevices(nsTArray<RefPtr<mozilla::dom::VRDevice>>& aDevices);
// Update the VR displays for this window
bool UpdateVRDisplays(nsTArray<RefPtr<mozilla::dom::VRDisplay>>& aDisplays);
#define EVENT(name_, id_, type_, struct_) \
mozilla::dom::EventHandlerNonNull* GetOn##name_() \
@ -1908,8 +1908,8 @@ protected:
// This is the CC generation the last time we called CanSkip.
uint32_t mCanSkipCCGeneration;
// The VRDevies for this window
nsTArray<RefPtr<mozilla::dom::VRDevice>> mVRDevices;
// The VR Displays for this window
nsTArray<RefPtr<mozilla::dom::VRDisplay>> mVRDisplays;
friend class nsDOMScriptableHelper;
friend class nsDOMWindowUtils;

Просмотреть файл

@ -1233,7 +1233,7 @@ DOMInterfaces = {
'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
},
'VRDevice': {
'VRDisplay': {
'concrete': False
},

Просмотреть файл

@ -519,7 +519,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "HDMIInputPort", b2g: true, permission: ["inputport"]},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "HMDVRDevice", release: false},
{name: "HMDVRDisplay", release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
"HTMLAllCollection",
// IMPORTANT: Do not change this list without review from a DOM peer!
@ -945,7 +945,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PopupBoxObject", xbl: true},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PositionSensorVRDevice", release: false},
{name: "PositionSensorVRDisplay", release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "PresentationDeviceInfoManager",
disabled: true,
@ -1392,7 +1392,7 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"VideoStreamTrack",
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "VRDevice", release: false},
{name: "VRDisplay", release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!
{name: "VRPositionState", release: false},
// IMPORTANT: Do not change this list without review from a DOM peer!

Просмотреть файл

@ -7,12 +7,12 @@
#include "nsWrapperCache.h"
#include "mozilla/dom/Element.h"
#include "mozilla/dom/VRDeviceBinding.h"
#include "mozilla/dom/VRDisplayBinding.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/VRDevice.h"
#include "mozilla/dom/VRDisplay.h"
#include "Navigator.h"
#include "gfxVR.h"
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
#include "VRManagerChild.h"
#include "nsIFrame.h"
@ -22,22 +22,22 @@ namespace mozilla {
namespace dom {
/*static*/ bool
VRDevice::RefreshVRDevices(dom::Navigator* aNavigator)
VRDisplay::RefreshVRDisplays(dom::Navigator* aNavigator)
{
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
return vm && vm->RefreshVRDevicesWithCallback(aNavigator);
return vm && vm->RefreshVRDisplaysWithCallback(aNavigator);
}
/*static*/ void
VRDevice::UpdateVRDevices(nsTArray<RefPtr<VRDevice>>& aDevices, nsISupports* aParent)
VRDisplay::UpdateVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDevices, nsISupports* aParent)
{
nsTArray<RefPtr<VRDevice>> devices;
nsTArray<RefPtr<VRDisplay>> devices;
gfx::VRManagerChild* vm = gfx::VRManagerChild::Get();
nsTArray<RefPtr<gfx::VRDeviceProxy>> proxyDevices;
if (vm && vm->GetVRDevices(proxyDevices)) {
nsTArray<RefPtr<gfx::VRDisplayProxy>> proxyDevices;
if (vm && vm->GetVRDisplays(proxyDevices)) {
for (size_t i = 0; i < proxyDevices.Length(); i++) {
RefPtr<gfx::VRDeviceProxy> proxyDevice = proxyDevices[i];
RefPtr<gfx::VRDisplayProxy> proxyDevice = proxyDevices[i];
bool isNewDevice = true;
for (size_t j = 0; j < aDevices.Length(); j++) {
if (aDevices[j]->GetHMD()->GetDeviceInfo() == proxyDevice->GetDeviceInfo()) {
@ -48,11 +48,11 @@ VRDevice::UpdateVRDevices(nsTArray<RefPtr<VRDevice>>& aDevices, nsISupports* aPa
if (isNewDevice) {
gfx::VRStateValidFlags sensorBits = proxyDevice->GetDeviceInfo().GetSupportedSensorStateBits();
devices.AppendElement(new HMDInfoVRDevice(aParent, proxyDevice));
devices.AppendElement(new HMDInfoVRDisplay(aParent, proxyDevice));
if (sensorBits & (gfx::VRStateValidFlags::State_Position |
gfx::VRStateValidFlags::State_Orientation))
{
devices.AppendElement(new HMDPositionVRDevice(aParent, proxyDevice));
devices.AppendElement(new HMDPositionVRDisplay(aParent, proxyDevice));
}
}
}
@ -227,32 +227,32 @@ VRPositionState::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
return VRPositionStateBinding::Wrap(aCx, this, aGivenProto);
}
NS_IMPL_CYCLE_COLLECTING_ADDREF(VRDevice)
NS_IMPL_CYCLE_COLLECTING_RELEASE(VRDevice)
NS_IMPL_CYCLE_COLLECTING_ADDREF(VRDisplay)
NS_IMPL_CYCLE_COLLECTING_RELEASE(VRDisplay)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(VRDevice)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(VRDisplay)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(VRDevice, mParent)
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(VRDisplay, mParent)
/* virtual */ JSObject*
HMDVRDevice::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
HMDVRDisplay::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return HMDVRDeviceBinding::Wrap(aCx, this, aGivenProto);
return HMDVRDisplayBinding::Wrap(aCx, this, aGivenProto);
}
/* virtual */ JSObject*
PositionSensorVRDevice::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
PositionSensorVRDisplay::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return PositionSensorVRDeviceBinding::Wrap(aCx, this, aGivenProto);
return PositionSensorVRDisplayBinding::Wrap(aCx, this, aGivenProto);
}
HMDInfoVRDevice::HMDInfoVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD)
: HMDVRDevice(aParent, aHMD)
HMDInfoVRDisplay::HMDInfoVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD)
: HMDVRDisplay(aParent, aHMD)
{
MOZ_COUNT_CTOR_INHERITED(HMDInfoVRDevice, HMDVRDevice);
MOZ_COUNT_CTOR_INHERITED(HMDInfoVRDisplay, HMDVRDisplay);
uint64_t hmdid = aHMD->GetDeviceInfo().GetDeviceID() << 8;
uint64_t devid = hmdid | 0x00; // we generate a devid with low byte 0 for the HMD, 1 for the position sensor
@ -269,16 +269,16 @@ HMDInfoVRDevice::HMDInfoVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD)
mValid = true;
}
HMDInfoVRDevice::~HMDInfoVRDevice()
HMDInfoVRDisplay::~HMDInfoVRDisplay()
{
MOZ_COUNT_DTOR_INHERITED(HMDInfoVRDevice, HMDVRDevice);
MOZ_COUNT_DTOR_INHERITED(HMDInfoVRDisplay, HMDVRDisplay);
}
/* If a field of view that is set to all 0's is passed in,
* the recommended field of view for that eye is used.
*/
void
HMDInfoVRDevice::SetFieldOfView(const VRFieldOfViewInit& aLeftFOV,
HMDInfoVRDisplay::SetFieldOfView(const VRFieldOfViewInit& aLeftFOV,
const VRFieldOfViewInit& aRightFOV,
double zNear, double zFar)
{
@ -288,20 +288,20 @@ HMDInfoVRDevice::SetFieldOfView(const VRFieldOfViewInit& aLeftFOV,
aRightFOV.mDownDegrees, aRightFOV.mLeftDegrees);
if (left.IsZero()) {
left = mHMD->GetDeviceInfo().GetRecommendedEyeFOV(VRDeviceInfo::Eye_Left);
left = mHMD->GetDeviceInfo().GetRecommendedEyeFOV(VRDisplayInfo::Eye_Left);
}
if (right.IsZero()) {
right = mHMD->GetDeviceInfo().GetRecommendedEyeFOV(VRDeviceInfo::Eye_Right);
right = mHMD->GetDeviceInfo().GetRecommendedEyeFOV(VRDisplayInfo::Eye_Right);
}
mHMD->SetFOV(left, right, zNear, zFar);
}
already_AddRefed<VREyeParameters> HMDInfoVRDevice::GetEyeParameters(VREye aEye)
already_AddRefed<VREyeParameters> HMDInfoVRDisplay::GetEyeParameters(VREye aEye)
{
gfx::IntSize sz(mHMD->GetDeviceInfo().SuggestedEyeResolution());
gfx::VRDeviceInfo::Eye eye = aEye == VREye::Left ? gfx::VRDeviceInfo::Eye_Left : gfx::VRDeviceInfo::Eye_Right;
gfx::VRDisplayInfo::Eye eye = aEye == VREye::Left ? gfx::VRDisplayInfo::Eye_Left : gfx::VRDisplayInfo::Eye_Right;
RefPtr<VREyeParameters> params =
new VREyeParameters(mParent,
gfx::VRFieldOfView(15, 15, 15, 15), // XXX min?
@ -313,10 +313,10 @@ already_AddRefed<VREyeParameters> HMDInfoVRDevice::GetEyeParameters(VREye aEye)
return params.forget();
}
HMDPositionVRDevice::HMDPositionVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD)
: PositionSensorVRDevice(aParent, aHMD)
HMDPositionVRDisplay::HMDPositionVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD)
: PositionSensorVRDisplay(aParent, aHMD)
{
MOZ_COUNT_CTOR_INHERITED(HMDPositionVRDevice, PositionSensorVRDevice);
MOZ_COUNT_CTOR_INHERITED(HMDPositionVRDisplay, PositionSensorVRDisplay);
uint64_t hmdid = aHMD->GetDeviceInfo().GetDeviceID() << 8;
uint64_t devid = hmdid | 0x01; // we generate a devid with low byte 0 for the HMD, 1 for the position sensor
@ -334,13 +334,13 @@ HMDPositionVRDevice::HMDPositionVRDevice(nsISupports* aParent, gfx::VRDeviceProx
mValid = true;
}
HMDPositionVRDevice::~HMDPositionVRDevice()
HMDPositionVRDisplay::~HMDPositionVRDisplay()
{
MOZ_COUNT_DTOR_INHERITED(HMDPositionVRDevice, PositionSensorVRDevice);
MOZ_COUNT_DTOR_INHERITED(HMDPositionVRDisplay, PositionSensorVRDisplay);
}
already_AddRefed<VRPositionState>
HMDPositionVRDevice::GetState()
HMDPositionVRDisplay::GetState()
{
gfx::VRHMDSensorState state = mHMD->GetSensorState();
RefPtr<VRPositionState> obj = new VRPositionState(mParent, state);
@ -349,7 +349,7 @@ HMDPositionVRDevice::GetState()
}
already_AddRefed<VRPositionState>
HMDPositionVRDevice::GetImmediateState()
HMDPositionVRDisplay::GetImmediateState()
{
gfx::VRHMDSensorState state = mHMD->GetImmediateSensorState();
RefPtr<VRPositionState> obj = new VRPositionState(mParent, state);
@ -358,7 +358,7 @@ HMDPositionVRDevice::GetImmediateState()
}
void
HMDPositionVRDevice::ResetSensor()
HMDPositionVRDisplay::ResetSensor()
{
mHMD->ZeroSensor();
}

Просмотреть файл

@ -4,14 +4,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_VRDevice_h_
#define mozilla_dom_VRDevice_h_
#ifndef mozilla_dom_VRDisplay_h_
#define mozilla_dom_VRDisplay_h_
#include <stdint.h>
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/TypedArray.h"
#include "mozilla/dom/VRDeviceBinding.h"
#include "mozilla/dom/VRDisplayBinding.h"
#include "mozilla/dom/DOMPoint.h"
#include "mozilla/dom/DOMRect.h"
@ -21,7 +21,7 @@
#include "nsWrapperCache.h"
#include "gfxVR.h"
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
namespace mozilla {
namespace dom {
@ -175,13 +175,13 @@ protected:
RefPtr<DOMRect> mRenderRect;
};
class VRDevice : public nsISupports,
class VRDisplay : public nsISupports,
public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(VRDevice)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(VRDisplay)
void GetHardwareUnitId(nsAString& aHWID) const { aHWID = mHWID; }
void GetDeviceId(nsAString& aDeviceId) const { aDeviceId = mDeviceId; }
@ -194,53 +194,53 @@ public:
return mParent;
}
enum VRDeviceType {
enum VRDisplayType {
HMD,
PositionSensor
};
VRDeviceType GetType() const { return mType; }
VRDisplayType GetType() const { return mType; }
static bool RefreshVRDevices(dom::Navigator* aNavigator);
static void UpdateVRDevices(nsTArray<RefPtr<VRDevice> >& aDevices,
static bool RefreshVRDisplays(dom::Navigator* aNavigator);
static void UpdateVRDisplays(nsTArray<RefPtr<VRDisplay> >& aDevices,
nsISupports* aParent);
gfx::VRDeviceProxy *GetHMD() {
gfx::VRDisplayProxy *GetHMD() {
return mHMD;
}
protected:
VRDevice(nsISupports* aParent,
gfx::VRDeviceProxy* aHMD,
VRDeviceType aType)
VRDisplay(nsISupports* aParent,
gfx::VRDisplayProxy* aHMD,
VRDisplayType aType)
: mParent(aParent)
, mHMD(aHMD)
, mType(aType)
, mValid(false)
{
MOZ_COUNT_CTOR(VRDevice);
MOZ_COUNT_CTOR(VRDisplay);
mHWID.AssignLiteral("uknown");
mDeviceId.AssignLiteral("unknown");
mDeviceName.AssignLiteral("unknown");
}
virtual ~VRDevice()
virtual ~VRDisplay()
{
MOZ_COUNT_DTOR(VRDevice);
MOZ_COUNT_DTOR(VRDisplay);
}
nsCOMPtr<nsISupports> mParent;
RefPtr<gfx::VRDeviceProxy> mHMD;
RefPtr<gfx::VRDisplayProxy> mHMD;
nsString mHWID;
nsString mDeviceId;
nsString mDeviceName;
VRDeviceType mType;
VRDisplayType mType;
bool mValid;
};
class HMDVRDevice : public VRDevice
class HMDVRDisplay : public VRDisplay
{
public:
virtual already_AddRefed<VREyeParameters> GetEyeParameters(VREye aEye) = 0;
@ -252,23 +252,23 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
protected:
HMDVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD)
: VRDevice(aParent, aHMD, VRDevice::HMD)
HMDVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD)
: VRDisplay(aParent, aHMD, VRDisplay::HMD)
{
MOZ_COUNT_CTOR_INHERITED(HMDVRDevice, VRDevice);
MOZ_COUNT_CTOR_INHERITED(HMDVRDisplay, VRDisplay);
}
virtual ~HMDVRDevice()
virtual ~HMDVRDisplay()
{
MOZ_COUNT_DTOR_INHERITED(HMDVRDevice, VRDevice);
MOZ_COUNT_DTOR_INHERITED(HMDVRDisplay, VRDisplay);
}
};
class HMDInfoVRDevice : public HMDVRDevice
class HMDInfoVRDisplay : public HMDVRDisplay
{
public:
HMDInfoVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD);
virtual ~HMDInfoVRDevice();
HMDInfoVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD);
virtual ~HMDInfoVRDisplay();
/* If a field of view that is set to all 0's is passed in,
* the recommended field of view for that eye is used.
@ -279,7 +279,7 @@ public:
virtual already_AddRefed<VREyeParameters> GetEyeParameters(VREye aEye) override;
};
class PositionSensorVRDevice : public VRDevice
class PositionSensorVRDisplay : public VRDisplay
{
public:
virtual already_AddRefed<VRPositionState> GetState() = 0;
@ -288,23 +288,23 @@ public:
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
protected:
explicit PositionSensorVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD)
: VRDevice(aParent, aHMD, VRDevice::PositionSensor)
explicit PositionSensorVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD)
: VRDisplay(aParent, aHMD, VRDisplay::PositionSensor)
{
MOZ_COUNT_CTOR_INHERITED(PositionSensorVRDevice, VRDevice);
MOZ_COUNT_CTOR_INHERITED(PositionSensorVRDisplay, VRDisplay);
}
virtual ~PositionSensorVRDevice()
virtual ~PositionSensorVRDisplay()
{
MOZ_COUNT_DTOR_INHERITED(PositionSensorVRDevice, VRDevice);
MOZ_COUNT_DTOR_INHERITED(PositionSensorVRDisplay, VRDisplay);
}
};
class HMDPositionVRDevice : public PositionSensorVRDevice
class HMDPositionVRDisplay : public PositionSensorVRDisplay
{
public:
HMDPositionVRDevice(nsISupports* aParent, gfx::VRDeviceProxy* aHMD);
~HMDPositionVRDevice();
HMDPositionVRDisplay(nsISupports* aParent, gfx::VRDisplayProxy* aHMD);
~HMDPositionVRDisplay();
virtual already_AddRefed<VRPositionState> GetState() override;
virtual already_AddRefed<VRPositionState> GetImmediateState() override;

Просмотреть файл

@ -5,11 +5,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS.mozilla.dom += [
'VRDevice.h',
'VRDisplay.h',
]
UNIFIED_SOURCES = [
'VRDevice.cpp',
'VRDisplay.cpp',
]
include('/ipc/chromium/chromium-config.mozbuild')

Просмотреть файл

@ -341,7 +341,7 @@ partial interface Navigator {
partial interface Navigator {
[Throws, Pref="dom.vr.enabled"]
Promise<sequence<VRDevice>> getVRDevices();
Promise<sequence<VRDisplay>> getVRDisplays();
};
#ifdef MOZ_B2G_BT

Просмотреть файл

@ -9,7 +9,7 @@ enum VREye {
};
[Pref="dom.vr.enabled",
HeaderFile="mozilla/dom/VRDevice.h"]
HeaderFile="mozilla/dom/VRDisplay.h"]
interface VRFieldOfViewReadOnly {
readonly attribute double upDegrees;
readonly attribute double rightDegrees;
@ -18,7 +18,7 @@ interface VRFieldOfViewReadOnly {
};
[Pref="dom.vr.enabled",
HeaderFile="mozilla/dom/VRDevice.h",
HeaderFile="mozilla/dom/VRDisplay.h",
Constructor(optional VRFieldOfViewInit fov),
Constructor(double upDegrees, double rightDegrees, double downDegrees, double leftDegrees)]
interface VRFieldOfView : VRFieldOfViewReadOnly {
@ -36,7 +36,7 @@ dictionary VRFieldOfViewInit {
};
[Pref="dom.vr.enabled",
HeaderFile="mozilla/dom/VRDevice.h"]
HeaderFile="mozilla/dom/VRDisplay.h"]
interface VRPositionState {
readonly attribute double timeStamp;
@ -53,7 +53,7 @@ interface VRPositionState {
};
[Pref="dom.vr.enabled",
HeaderFile="mozilla/dom/VRDevice.h"]
HeaderFile="mozilla/dom/VRDisplay.h"]
interface VREyeParameters {
/* These values are expected to be static per-device/per-user */
[Constant, Cached] readonly attribute VRFieldOfView minimumFieldOfView;
@ -67,10 +67,10 @@ interface VREyeParameters {
};
[Pref="dom.vr.enabled"]
interface VRDevice {
interface VRDisplay {
/**
* An identifier for the distinct hardware unit that this
* VR Device is a part of. All VRDevice/Sensors that come
* VR Device is a part of. All VRDisplay/Sensors that come
* from the same hardware will have the same hardwareId
*/
[Constant] readonly attribute DOMString hardwareUnitId;
@ -89,8 +89,8 @@ interface VRDevice {
};
[Pref="dom.vr.enabled",
HeaderFile="mozilla/dom/VRDevice.h"]
interface HMDVRDevice : VRDevice {
HeaderFile="mozilla/dom/VRDisplay.h"]
interface HMDVRDisplay : VRDisplay {
// Return the current VREyeParameters for the given eye
VREyeParameters getEyeParameters(VREye whichEye);
@ -104,8 +104,8 @@ interface HMDVRDevice : VRDevice {
};
[Pref="dom.vr.enabled" ,
HeaderFile="mozilla/dom/VRDevice.h"]
interface PositionSensorVRDevice : VRDevice {
HeaderFile="mozilla/dom/VRDisplay.h"]
interface PositionSensorVRDisplay : VRDisplay {
/*
* Return a VRPositionState dictionary containing the state of this position sensor
* for the current frame if within a requestAnimationFrame callback, or for the

Просмотреть файл

@ -581,7 +581,7 @@ WEBIDL_FILES = [
'VideoStreamTrack.webidl',
'VideoTrack.webidl',
'VideoTrackList.webidl',
'VRDevice.webidl',
'VRDisplay.webidl',
'VTTCue.webidl',
'VTTRegion.webidl',
'WaveShaperNode.webidl',

Просмотреть файл

@ -20,17 +20,17 @@
#include "../layers/d3d11/CompositorD3D11.h"
#endif
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
#include "VRManagerChild.h"
using namespace mozilla;
using namespace mozilla::gfx;
VRDeviceProxy::VRDeviceProxy(const VRDeviceUpdate& aDeviceUpdate)
VRDisplayProxy::VRDisplayProxy(const VRDisplayUpdate& aDeviceUpdate)
: mDeviceInfo(aDeviceUpdate.mDeviceInfo)
, mSensorState(aDeviceUpdate.mSensorState)
{
MOZ_COUNT_CTOR(VRDeviceProxy);
MOZ_COUNT_CTOR(VRDisplayProxy);
if (mDeviceInfo.mScreenRect.width && mDeviceInfo.mScreenRect.height) {
if (mDeviceInfo.mIsFakeScreen) {
@ -51,19 +51,19 @@ VRDeviceProxy::VRDeviceProxy(const VRDeviceUpdate& aDeviceUpdate)
}
}
VRDeviceProxy::~VRDeviceProxy() {
MOZ_COUNT_DTOR(VRDeviceProxy);
VRDisplayProxy::~VRDisplayProxy() {
MOZ_COUNT_DTOR(VRDisplayProxy);
}
void
VRDeviceProxy::UpdateDeviceInfo(const VRDeviceUpdate& aDeviceUpdate)
VRDisplayProxy::UpdateDeviceInfo(const VRDisplayUpdate& aDeviceUpdate)
{
mDeviceInfo = aDeviceUpdate.mDeviceInfo;
mSensorState = aDeviceUpdate.mSensorState;
}
bool
VRDeviceProxy::SetFOV(const VRFieldOfView& aFOVLeft, const VRFieldOfView& aFOVRight,
VRDisplayProxy::SetFOV(const VRFieldOfView& aFOVLeft, const VRFieldOfView& aFOVRight,
double zNear, double zFar)
{
VRManagerChild *vm = VRManagerChild::Get();
@ -72,14 +72,14 @@ VRDeviceProxy::SetFOV(const VRFieldOfView& aFOVLeft, const VRFieldOfView& aFOVRi
}
void
VRDeviceProxy::ZeroSensor()
VRDisplayProxy::ZeroSensor()
{
VRManagerChild *vm = VRManagerChild::Get();
vm->SendResetSensor(mDeviceInfo.mDeviceID);
}
VRHMDSensorState
VRDeviceProxy::GetSensorState()
VRDisplayProxy::GetSensorState()
{
VRManagerChild *vm = VRManagerChild::Get();
Unused << vm->SendKeepSensorTracking(mDeviceInfo.mDeviceID);
@ -87,7 +87,7 @@ VRDeviceProxy::GetSensorState()
}
VRHMDSensorState
VRDeviceProxy::GetImmediateSensorState()
VRDisplayProxy::GetImmediateSensorState()
{
// XXX TODO - Need to perform IPC call to get the current sensor
// state rather than the predictive state used for the frame rendering.
@ -95,7 +95,7 @@ VRDeviceProxy::GetImmediateSensorState()
}
void
VRDeviceProxy::UpdateSensorState(const VRHMDSensorState& aSensorState)
VRDisplayProxy::UpdateSensorState(const VRHMDSensorState& aSensorState)
{
mSensorState = aSensorState;
}
@ -157,7 +157,7 @@ NS_IMPL_ISUPPORTS(FakeScreen, nsIScreen)
/* static */ already_AddRefed<nsIScreen>
VRDeviceProxy::MakeFakeScreen(const IntRect& aScreenRect)
VRDisplayProxy::MakeFakeScreen(const IntRect& aScreenRect)
{
nsCOMPtr<nsIScreen> screen = new FakeScreen(aScreenRect);
return screen.forget();

Просмотреть файл

@ -17,17 +17,17 @@ namespace gfx {
class VRManagerChild;
class VRDeviceProxy
class VRDisplayProxy
{
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDeviceProxy)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRDisplayProxy)
explicit VRDeviceProxy(const VRDeviceUpdate& aDeviceUpdate);
explicit VRDisplayProxy(const VRDisplayUpdate& aDeviceUpdate);
void UpdateDeviceInfo(const VRDeviceUpdate& aDeviceUpdate);
void UpdateDeviceInfo(const VRDisplayUpdate& aDeviceUpdate);
void UpdateSensorState(const VRHMDSensorState& aSensorState);
const VRDeviceInfo& GetDeviceInfo() const { return mDeviceInfo; }
const VRDisplayInfo& GetDeviceInfo() const { return mDeviceInfo; }
virtual VRHMDSensorState GetSensorState();
virtual VRHMDSensorState GetImmediateSensorState();
@ -41,9 +41,9 @@ public:
nsIScreen* GetScreen() { return mScreen; }
protected:
virtual ~VRDeviceProxy();
virtual ~VRDisplayProxy();
VRDeviceInfo mDeviceInfo;
VRDisplayInfo mDeviceInfo;
VRHMDSensorState mSensorState;
nsCOMPtr<nsIScreen> mScreen;

Просмотреть файл

@ -8,7 +8,7 @@
#include "VRManagerParent.h"
#include "gfxVR.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/dom/VRDevice.h"
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/unused.h"
#include "gfxPrefs.h"
@ -71,7 +71,7 @@ VRManager::~VRManager()
void
VRManager::Destroy()
{
mVRDevices.Clear();
mVRDisplays.Clear();
for (uint32_t i = 0; i < mManagers.Length(); ++i) {
mManagers[i]->Destroy();
}
@ -116,15 +116,15 @@ VRManager::RemoveVRManagerParent(VRManagerParent* aVRManagerParent)
void
VRManager::NotifyVsync(const TimeStamp& aVsyncTimestamp)
{
for (auto iter = mVRDevices.Iter(); !iter.Done(); iter.Next()) {
for (auto iter = mVRDisplays.Iter(); !iter.Done(); iter.Next()) {
gfx::VRHMDInfo* device = iter.UserData();
device->NotifyVsync(aVsyncTimestamp);
}
DispatchVRDeviceSensorUpdate();
DispatchVRDisplaySensorUpdate();
}
void
VRManager::RefreshVRDevices()
VRManager::RefreshVRDisplays()
{
nsTArray<RefPtr<gfx::VRHMDInfo> > devices;
@ -134,7 +134,7 @@ VRManager::RefreshVRDevices()
bool deviceInfoChanged = false;
if (devices.Length() != mVRDevices.Count()) {
if (devices.Length() != mVRDisplays.Count()) {
deviceInfoChanged = true;
}
@ -151,22 +151,22 @@ VRManager::RefreshVRDevices()
}
if (deviceInfoChanged) {
mVRDevices.Clear();
mVRDisplays.Clear();
for (const auto& device: devices) {
mVRDevices.Put(device->GetDeviceInfo().GetDeviceID(), device);
mVRDisplays.Put(device->GetDeviceInfo().GetDeviceID(), device);
}
}
DispatchVRDeviceInfoUpdate();
DispatchVRDisplayInfoUpdate();
}
void
VRManager::DispatchVRDeviceInfoUpdate()
VRManager::DispatchVRDisplayInfoUpdate()
{
nsTArray<VRDeviceUpdate> update;
for (auto iter = mVRDevices.Iter(); !iter.Done(); iter.Next()) {
nsTArray<VRDisplayUpdate> update;
for (auto iter = mVRDisplays.Iter(); !iter.Done(); iter.Next()) {
gfx::VRHMDInfo* device = iter.UserData();
update.AppendElement(VRDeviceUpdate(device->GetDeviceInfo(),
update.AppendElement(VRDisplayUpdate(device->GetDeviceInfo(),
device->GetSensorState()));
}
@ -176,11 +176,11 @@ VRManager::DispatchVRDeviceInfoUpdate()
}
void
VRManager::DispatchVRDeviceSensorUpdate()
VRManager::DispatchVRDisplaySensorUpdate()
{
nsTArray<VRSensorUpdate> update;
for (auto iter = mVRDevices.Iter(); !iter.Done(); iter.Next()) {
for (auto iter = mVRDisplays.Iter(); !iter.Done(); iter.Next()) {
gfx::VRHMDInfo* device = iter.UserData();
update.AppendElement(VRSensorUpdate(device->GetDeviceInfo().GetDeviceID(),
device->GetSensorState()));
@ -196,7 +196,7 @@ RefPtr<gfx::VRHMDInfo>
VRManager::GetDevice(const uint32_t& aDeviceID)
{
RefPtr<gfx::VRHMDInfo> device;
if (mVRDevices.Get(aDeviceID, getter_AddRefs(device))) {
if (mVRDisplays.Get(aDeviceID, getter_AddRefs(device))) {
return device;
}
return nullptr;

Просмотреть файл

@ -30,7 +30,7 @@ public:
void RemoveVRManagerParent(VRManagerParent* aVRManagerParent);
void NotifyVsync(const TimeStamp& aVsyncTimestamp);
void RefreshVRDevices();
void RefreshVRDisplays();
RefPtr<gfx::VRHMDInfo> GetDevice(const uint32_t& aDeviceID);
protected:
@ -42,8 +42,8 @@ private:
void Init();
void Destroy();
void DispatchVRDeviceInfoUpdate();
void DispatchVRDeviceSensorUpdate();
void DispatchVRDisplayInfoUpdate();
void DispatchVRDisplaySensorUpdate();
typedef nsTHashtable<nsRefPtrHashKey<VRManagerParent>> VRManagerParentSet;
VRManagerParentSet mVRManagerParents;
@ -52,7 +52,7 @@ private:
VRHMDManagerArray mManagers;
typedef nsRefPtrHashtable<nsUint32HashKey, gfx::VRHMDInfo> VRHMDInfoHashMap;
VRHMDInfoHashMap mVRDevices;
VRHMDInfoHashMap mVRDisplays;
Atomic<bool> mInitialized;

Просмотреть файл

@ -88,7 +88,7 @@ struct VRDistortionConstants {
float destinationScaleAndOffset[4];
};
struct VRDeviceInfo
struct VRDisplayInfo
{
VRHMDType GetType() const { return mType; }
uint32_t GetDeviceID() const { return mDeviceID; }
@ -112,11 +112,11 @@ struct VRDeviceInfo
VRHMDType mType;
nsCString mDeviceName;
VRStateValidFlags mSupportedSensorBits;
VRFieldOfView mMaximumEyeFOV[VRDeviceInfo::NumEyes];
VRFieldOfView mRecommendedEyeFOV[VRDeviceInfo::NumEyes];
VRFieldOfView mEyeFOV[VRDeviceInfo::NumEyes];
Point3D mEyeTranslation[VRDeviceInfo::NumEyes];
Matrix4x4 mEyeProjectionMatrix[VRDeviceInfo::NumEyes];
VRFieldOfView mMaximumEyeFOV[VRDisplayInfo::NumEyes];
VRFieldOfView mRecommendedEyeFOV[VRDisplayInfo::NumEyes];
VRFieldOfView mEyeFOV[VRDisplayInfo::NumEyes];
Point3D mEyeTranslation[VRDisplayInfo::NumEyes];
Matrix4x4 mEyeProjectionMatrix[VRDisplayInfo::NumEyes];
/* Suggested resolution for rendering a single eye.
* Assumption is that left/right rendering will be 2x of this size.
* XXX fix this for vertical displays
@ -128,7 +128,7 @@ struct VRDeviceInfo
bool operator==(const VRDeviceInfo& other) const {
bool operator==(const VRDisplayInfo& other) const {
return mType == other.mType &&
mDeviceID == other.mDeviceID &&
mDeviceName == other.mDeviceName &&
@ -148,7 +148,7 @@ struct VRDeviceInfo
mEyeProjectionMatrix[1] == other.mEyeProjectionMatrix[1];
}
bool operator!=(const VRDeviceInfo& other) const {
bool operator!=(const VRDisplayInfo& other) const {
return !(*this == other);
}
};
@ -181,14 +181,14 @@ struct VRSensorUpdate {
VRHMDSensorState mSensorState;
};
struct VRDeviceUpdate {
VRDeviceUpdate() { }; // Required for ipdl binding
VRDeviceUpdate(const VRDeviceInfo& aDeviceInfo,
struct VRDisplayUpdate {
VRDisplayUpdate() { }; // Required for ipdl binding
VRDisplayUpdate(const VRDisplayInfo& aDeviceInfo,
const VRHMDSensorState& aSensorState)
: mDeviceInfo(aDeviceInfo)
, mSensorState(aSensorState) { };
VRDeviceInfo mDeviceInfo;
VRDisplayInfo mDeviceInfo;
VRHMDSensorState mSensorState;
};
@ -251,7 +251,7 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRHMDInfo)
const VRHMDConfiguration& GetConfiguration() const { return mConfiguration; }
const VRDeviceInfo& GetDeviceInfo() const { return mDeviceInfo; }
const VRDisplayInfo& GetDeviceInfo() const { return mDeviceInfo; }
/* set the FOV for this HMD unit; this triggers a computation of all the remaining bits. Returns false if it fails */
virtual bool SetFOV(const VRFieldOfView& aFOVLeft, const VRFieldOfView& aFOVRight,
@ -281,8 +281,8 @@ protected:
virtual ~VRHMDInfo();
VRHMDConfiguration mConfiguration;
VRDeviceInfo mDeviceInfo;
VRDistortionMesh mDistortionMesh[VRDeviceInfo::NumEyes];
VRDisplayInfo mDeviceInfo;
VRDistortionMesh mDistortionMesh[VRDisplayInfo::NumEyes];
};
class VRHMDManager {

Просмотреть файл

@ -236,8 +236,8 @@ HMDInfoOSVR::HMDInfoOSVR(OSVR_ClientContext* context,
OSVR_DisplayDimension width, height;
osvr_ClientGetDisplayDimensions(*m_display, 0, &width, &height);
SetFOV(mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Left],
mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Right], 0.01,
SetFOV(mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Left],
mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Right], 0.01,
10000.0);
}
@ -284,8 +284,8 @@ HMDInfoOSVR::SetFOV(const gfx::VRFieldOfView& aFOVLeft,
mConfiguration.hmdType = mDeviceInfo.mType;
mConfiguration.value = 0;
mConfiguration.fov[VRDeviceInfo::Eye_Left] = aFOVLeft;
mConfiguration.fov[VRDeviceInfo::Eye_Right] = aFOVRight;
mConfiguration.fov[VRDisplayInfo::Eye_Left] = aFOVLeft;
mConfiguration.fov[VRDisplayInfo::Eye_Right] = aFOVRight;
return true;
}

Просмотреть файл

@ -314,11 +314,11 @@ HMDInfoOculus::HMDInfoOculus(ovrSession aSession)
mDeviceInfo.mSupportedSensorBits |= VRStateValidFlags::State_Position;
}
mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Left] = FromFovPort(mDesc.DefaultEyeFov[ovrEye_Left]);
mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Right] = FromFovPort(mDesc.DefaultEyeFov[ovrEye_Right]);
mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Left] = FromFovPort(mDesc.DefaultEyeFov[ovrEye_Left]);
mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Right] = FromFovPort(mDesc.DefaultEyeFov[ovrEye_Right]);
mDeviceInfo.mMaximumEyeFOV[VRDeviceInfo::Eye_Left] = FromFovPort(mDesc.MaxEyeFov[ovrEye_Left]);
mDeviceInfo.mMaximumEyeFOV[VRDeviceInfo::Eye_Right] = FromFovPort(mDesc.MaxEyeFov[ovrEye_Right]);
mDeviceInfo.mMaximumEyeFOV[VRDisplayInfo::Eye_Left] = FromFovPort(mDesc.MaxEyeFov[ovrEye_Left]);
mDeviceInfo.mMaximumEyeFOV[VRDisplayInfo::Eye_Right] = FromFovPort(mDesc.MaxEyeFov[ovrEye_Right]);
uint32_t w = mDesc.Resolution.w;
uint32_t h = mDesc.Resolution.h;
@ -328,7 +328,7 @@ HMDInfoOculus::HMDInfoOculus(ovrSession aSession)
mDeviceInfo.mScreenRect.height = std::min(w, h);
mDeviceInfo.mIsFakeScreen = true;
SetFOV(mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Left], mDeviceInfo.mRecommendedEyeFOV[VRDeviceInfo::Eye_Right], 0.01, 10000.0);
SetFOV(mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Left], mDeviceInfo.mRecommendedEyeFOV[VRDisplayInfo::Eye_Right], 0.01, 10000.0);
for (int i = 0; i < kMaxLatencyFrames; i++) {
mLastSensorState[i].Clear();
@ -352,7 +352,7 @@ HMDInfoOculus::SetFOV(const gfx::VRFieldOfView& aFOVLeft, const gfx::VRFieldOfVi
ovrSizei texSize[2];
// get eye parameters and create the mesh
for (uint32_t eye = 0; eye < VRDeviceInfo::NumEyes; eye++) {
for (uint32_t eye = 0; eye < VRDisplayInfo::NumEyes; eye++) {
mDeviceInfo.mEyeFOV[eye] = eye == 0 ? aFOVLeft : aFOVRight;
mFOVPort[eye] = ToFovPort(mDeviceInfo.mEyeFOV[eye]);
@ -368,8 +368,8 @@ HMDInfoOculus::SetFOV(const gfx::VRFieldOfView& aFOVLeft, const gfx::VRFieldOfVi
}
// take the max of both for eye resolution
mDeviceInfo.mEyeResolution.width = std::max(texSize[VRDeviceInfo::Eye_Left].w, texSize[VRDeviceInfo::Eye_Right].w);
mDeviceInfo.mEyeResolution.height = std::max(texSize[VRDeviceInfo::Eye_Left].h, texSize[VRDeviceInfo::Eye_Right].h);
mDeviceInfo.mEyeResolution.width = std::max(texSize[VRDisplayInfo::Eye_Left].w, texSize[VRDisplayInfo::Eye_Right].w);
mDeviceInfo.mEyeResolution.height = std::max(texSize[VRDisplayInfo::Eye_Left].h, texSize[VRDisplayInfo::Eye_Right].h);
mConfiguration.hmdType = mDeviceInfo.mType;
mConfiguration.value = 0;

Просмотреть файл

@ -8,7 +8,7 @@
include "VRMessageUtils.h";
using struct mozilla::gfx::VRFieldOfView from "gfxVR.h";
using struct mozilla::gfx::VRDeviceUpdate from "gfxVR.h";
using struct mozilla::gfx::VRDisplayUpdate from "gfxVR.h";
using struct mozilla::gfx::VRSensorUpdate from "gfxVR.h";
namespace mozilla {
@ -48,7 +48,7 @@ child:
// be sent to all children when the parent receives RefreshDevices, even
// if no changes have been detected. This ensures that Promises exposed
// through DOM calls are always resolved.
async UpdateDeviceInfo(VRDeviceUpdate[] aDeviceUpdates);
async UpdateDeviceInfo(VRDisplayUpdate[] aDeviceUpdates);
// Notify children of updated VR device sensor states. This will be
// sent once per frame for at least one second after the parent receives

Просмотреть файл

@ -7,7 +7,7 @@
#include "VRManagerChild.h"
#include "VRManagerParent.h"
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/layers/CompositorThread.h" // for CompositorThread
#include "mozilla/dom/Navigator.h"
@ -121,11 +121,11 @@ VRManagerChild::Destroy()
}
bool
VRManagerChild::RecvUpdateDeviceInfo(nsTArray<VRDeviceUpdate>&& aDeviceUpdates)
VRManagerChild::RecvUpdateDeviceInfo(nsTArray<VRDisplayUpdate>&& aDeviceUpdates)
{
// mDevices could be a hashed container for more scalability, but not worth
// it now as we expect < 10 entries.
nsTArray<RefPtr<VRDeviceProxy> > devices;
nsTArray<RefPtr<VRDisplayProxy> > devices;
for (auto& deviceUpdate: aDeviceUpdates) {
bool isNewDevice = true;
for (auto& device: mDevices) {
@ -137,7 +137,7 @@ VRManagerChild::RecvUpdateDeviceInfo(nsTArray<VRDeviceUpdate>&& aDeviceUpdates)
}
}
if (isNewDevice) {
devices.AppendElement(new VRDeviceProxy(deviceUpdate));
devices.AppendElement(new VRDisplayProxy(deviceUpdate));
}
}
@ -145,7 +145,7 @@ VRManagerChild::RecvUpdateDeviceInfo(nsTArray<VRDeviceUpdate>&& aDeviceUpdates)
for (auto& nav: mNavigatorCallbacks) {
nav->NotifyVRDevicesUpdated();
nav->NotifyVRDisplaysUpdated();
}
mNavigatorCallbacks.Clear();
@ -171,14 +171,14 @@ VRManagerChild::RecvUpdateDeviceSensors(nsTArray<VRSensorUpdate>&& aDeviceSensor
}
bool
VRManagerChild::GetVRDevices(nsTArray<RefPtr<VRDeviceProxy> >& aDevices)
VRManagerChild::GetVRDisplays(nsTArray<RefPtr<VRDisplayProxy> >& aDevices)
{
aDevices = mDevices;
return true;
}
bool
VRManagerChild::RefreshVRDevicesWithCallback(dom::Navigator* aNavigator)
VRManagerChild::RefreshVRDisplaysWithCallback(dom::Navigator* aNavigator)
{
bool success = SendRefreshDevices();
if (success) {

Просмотреть файл

@ -14,10 +14,10 @@
namespace mozilla {
namespace dom {
class Navigator;
class VRDevice;
class VRDisplay;
} // namespace dom
namespace gfx {
class VRDeviceProxy;
class VRDisplayProxy;
class VRManagerChild : public PVRManagerChild
@ -26,8 +26,8 @@ public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING_WITH_MAIN_THREAD_DESTRUCTION(VRManagerChild)
int GetInputFrameID();
bool GetVRDevices(nsTArray<RefPtr<VRDeviceProxy> >& aDevices);
bool RefreshVRDevicesWithCallback(dom::Navigator* aNavigator);
bool GetVRDisplays(nsTArray<RefPtr<VRDisplayProxy> >& aDevices);
bool RefreshVRDisplaysWithCallback(dom::Navigator* aNavigator);
static void InitSameProcess();
static void InitWithGPUProcess(Endpoint<PVRManagerChild>&& aEndpoint);
@ -44,14 +44,14 @@ protected:
void Destroy();
static void DeferredDestroy(RefPtr<VRManagerChild> aVRManagerChild);
virtual bool RecvUpdateDeviceInfo(nsTArray<VRDeviceUpdate>&& aDeviceUpdates) override;
virtual bool RecvUpdateDeviceInfo(nsTArray<VRDisplayUpdate>&& aDeviceUpdates) override;
virtual bool RecvUpdateDeviceSensors(nsTArray<VRSensorUpdate>&& aDeviceSensorUpdates) override;
friend class layers::CompositorBridgeChild;
private:
nsTArray<RefPtr<VRDeviceProxy> > mDevices;
nsTArray<RefPtr<VRDisplayProxy> > mDevices;
nsTArray<dom::Navigator*> mNavigatorCallbacks;
int32_t mInputFrameID;

Просмотреть файл

@ -133,7 +133,7 @@ bool
VRManagerParent::RecvRefreshDevices()
{
VRManager* vm = VRManager::Get();
vm->RefreshVRDevices();
vm->RefreshVRDisplays();
return true;
}

Просмотреть файл

@ -27,9 +27,9 @@ struct ParamTraits<mozilla::gfx::VRStateValidFlags> :
mozilla::gfx::VRStateValidFlags::State_All> {};
template <>
struct ParamTraits<mozilla::gfx::VRDeviceUpdate>
struct ParamTraits<mozilla::gfx::VRDisplayUpdate>
{
typedef mozilla::gfx::VRDeviceUpdate paramType;
typedef mozilla::gfx::VRDisplayUpdate paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
@ -69,9 +69,9 @@ struct ParamTraits<mozilla::gfx::VRSensorUpdate>
};
template <>
struct ParamTraits<mozilla::gfx::VRDeviceInfo>
struct ParamTraits<mozilla::gfx::VRDisplayInfo>
{
typedef mozilla::gfx::VRDeviceInfo paramType;
typedef mozilla::gfx::VRDisplayInfo paramType;
static void Write(Message* aMsg, const paramType& aParam)
{
@ -82,7 +82,7 @@ struct ParamTraits<mozilla::gfx::VRDeviceInfo>
WriteParam(aMsg, aParam.mEyeResolution);
WriteParam(aMsg, aParam.mScreenRect);
WriteParam(aMsg, aParam.mIsFakeScreen);
for (int i = 0; i < mozilla::gfx::VRDeviceInfo::NumEyes; i++) {
for (int i = 0; i < mozilla::gfx::VRDisplayInfo::NumEyes; i++) {
WriteParam(aMsg, aParam.mMaximumEyeFOV[i]);
WriteParam(aMsg, aParam.mRecommendedEyeFOV[i]);
WriteParam(aMsg, aParam.mEyeFOV[i]);
@ -102,7 +102,7 @@ struct ParamTraits<mozilla::gfx::VRDeviceInfo>
!ReadParam(aMsg, aIter, &(aResult->mIsFakeScreen))) {
return false;
}
for (int i = 0; i < mozilla::gfx::VRDeviceInfo::NumEyes; i++) {
for (int i = 0; i < mozilla::gfx::VRDisplayInfo::NumEyes; i++) {
if (!ReadParam(aMsg, aIter, &(aResult->mMaximumEyeFOV[i])) ||
!ReadParam(aMsg, aIter, &(aResult->mRecommendedEyeFOV[i])) ||
!ReadParam(aMsg, aIter, &(aResult->mEyeFOV[i])) ||

Просмотреть файл

@ -9,7 +9,7 @@ EXPORTS += [
'ipc/VRManagerChild.h',
'ipc/VRManagerParent.h',
'ipc/VRMessageUtils.h',
'VRDeviceProxy.h',
'VRDisplayProxy.h',
'VRManager.h',
]
@ -23,7 +23,7 @@ UNIFIED_SOURCES += [
'gfxVROSVR.cpp',
'ipc/VRManagerChild.cpp',
'ipc/VRManagerParent.cpp',
'VRDeviceProxy.cpp',
'VRDisplayProxy.cpp',
'VRManager.cpp',
]

Просмотреть файл

@ -19,7 +19,7 @@
#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/KeyframeEffect.h"
#include "mozilla/gfx/2D.h"
#include "VRDeviceProxy.h"
#include "VRDisplayProxy.h"
#include "mozilla/layers/PLayerTransaction.h"
#include "nsCSSRendering.h"
#include "nsRenderingContext.h"