Bug 1096328 - Remove nativeOwnership from Bindings.conf, make VRFieldOfView use a binding that owns its native. r=vlad.

--HG--
extra : rebase_source : 002dc062e271722fc4914f19362489de8420d3dd
This commit is contained in:
Peter Van der Beken 2014-12-11 20:15:32 +01:00
Родитель eecdaa8a30
Коммит cd0864e1c1
4 изменённых файлов: 33 добавлений и 45 удалений

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

@ -1255,8 +1255,13 @@ DOMInterfaces = {
'wrapperCache': False,
}],
'VRFieldOfView': {
'wrapperCache': False,
},
'VRFieldOfViewReadOnly': {
'concrete': False
'concrete': False,
'wrapperCache': False,
},
'VRDevice': {

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

@ -17,32 +17,22 @@ using namespace mozilla::gfx;
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(VRFieldOfView, mParent)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(VRFieldOfView, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(VRFieldOfView, Release)
already_AddRefed<VRFieldOfView>
VRFieldOfView*
VRFieldOfView::Constructor(const GlobalObject& aGlobal, const VRFieldOfViewInit& aParams,
ErrorResult& aRV)
{
nsRefPtr<VRFieldOfView> obj =
new VRFieldOfView(aGlobal.GetAsSupports(),
aParams.mUpDegrees, aParams.mRightDegrees,
aParams.mDownDegrees, aParams.mLeftDegrees);
return obj.forget();
return new VRFieldOfView(aParams.mUpDegrees, aParams.mRightDegrees,
aParams.mDownDegrees, aParams.mLeftDegrees);
}
already_AddRefed<VRFieldOfView>
VRFieldOfView*
VRFieldOfView::Constructor(const GlobalObject& aGlobal,
double aUpDegrees, double aRightDegrees,
double aDownDegrees, double aLeftDegrees,
ErrorResult& aRV)
{
nsRefPtr<VRFieldOfView> obj =
new VRFieldOfView(aGlobal.GetAsSupports(),
aUpDegrees, aRightDegrees,
aDownDegrees, aLeftDegrees);
return obj.forget();
return new VRFieldOfView(aUpDegrees, aRightDegrees, aDownDegrees,
aLeftDegrees);
}
JSObject*
@ -209,17 +199,17 @@ public:
return obj.forget();
}
virtual already_AddRefed<VRFieldOfView> GetCurrentEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
virtual VRFieldOfView* GetCurrentEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
{
return CopyFieldOfView(mHMD->GetEyeFOV(EyeToEye(aEye)));
}
virtual already_AddRefed<VRFieldOfView> GetRecommendedEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
virtual VRFieldOfView* GetRecommendedEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
{
return CopyFieldOfView(mHMD->GetRecommendedEyeFOV(EyeToEye(aEye)));
}
virtual already_AddRefed<VRFieldOfView> GetMaximumEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
virtual VRFieldOfView* GetMaximumEyeFieldOfView(VREye aEye) MOZ_OVERRIDE
{
return CopyFieldOfView(mHMD->GetMaximumEyeFOV(EyeToEye(aEye)));
}
@ -235,13 +225,11 @@ public:
}
protected:
already_AddRefed<VRFieldOfView>
VRFieldOfView*
CopyFieldOfView(const gfx::VRFieldOfView& aSrc)
{
nsRefPtr<VRFieldOfView> obj =
new VRFieldOfView(mParent, aSrc.upDegrees, aSrc.rightDegrees,
aSrc.downDegrees, aSrc.leftDegrees);
return obj.forget();
return new VRFieldOfView(aSrc.upDegrees, aSrc.rightDegrees,
aSrc.downDegrees, aSrc.leftDegrees);
}
};

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

@ -26,14 +26,12 @@ namespace dom {
class Element;
class VRFieldOfViewReadOnly : public nsWrapperCache
class VRFieldOfViewReadOnly : public NonRefcountedDOMObject
{
public:
VRFieldOfViewReadOnly(nsISupports* aParent,
double aUpDegrees, double aRightDegrees,
VRFieldOfViewReadOnly(double aUpDegrees, double aRightDegrees,
double aDownDegrees, double aLeftDegrees)
: mParent(aParent)
, mUpDegrees(aUpDegrees)
: mUpDegrees(aUpDegrees)
, mRightDegrees(aRightDegrees)
, mDownDegrees(aDownDegrees)
, mLeftDegrees(aLeftDegrees)
@ -46,7 +44,6 @@ public:
double LeftDegrees() const { return mLeftDegrees; }
protected:
nsCOMPtr<nsISupports> mParent;
double mUpDegrees;
double mRightDegrees;
double mDownDegrees;
@ -55,29 +52,23 @@ protected:
class VRFieldOfView MOZ_FINAL : public VRFieldOfViewReadOnly
{
~VRFieldOfView() {}
public:
explicit VRFieldOfView(nsISupports* aParent,
double aUpDegrees = 0.0, double aRightDegrees = 0.0,
explicit VRFieldOfView(double aUpDegrees = 0.0, double aRightDegrees = 0.0,
double aDownDegrees = 0.0, double aLeftDegrees = 0.0)
: VRFieldOfViewReadOnly(aParent, aUpDegrees, aRightDegrees, aDownDegrees, aLeftDegrees)
: VRFieldOfViewReadOnly(aUpDegrees, aRightDegrees, aDownDegrees, aLeftDegrees)
{}
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(VRFieldOfView)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(VRFieldOfView)
static already_AddRefed<VRFieldOfView>
static VRFieldOfView*
Constructor(const GlobalObject& aGlobal, const VRFieldOfViewInit& aParams,
ErrorResult& aRv);
static already_AddRefed<VRFieldOfView>
static VRFieldOfView*
Constructor(const GlobalObject& aGlobal,
double aUpDegrees, double aRightDegrees,
double aDownDegrees, double aLeftDegrees,
ErrorResult& aRv);
nsISupports* GetParentObject() const { return mParent; }
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
JSObject* WrapObject(JSContext* aCx);
void SetUpDegrees(double aVal) { mUpDegrees = aVal; }
void SetRightDegrees(double aVal) { mRightDegrees = aVal; }
@ -190,9 +181,9 @@ public:
virtual void SetFieldOfView(const VRFieldOfViewInit& aLeftFOV,
const VRFieldOfViewInit& aRightFOV,
double zNear, double zFar) = 0;
virtual already_AddRefed<VRFieldOfView> GetCurrentEyeFieldOfView(VREye aEye) = 0;
virtual already_AddRefed<VRFieldOfView> GetRecommendedEyeFieldOfView(VREye aEye) = 0;
virtual already_AddRefed<VRFieldOfView> GetMaximumEyeFieldOfView(VREye aEye) = 0;
virtual VRFieldOfView* GetCurrentEyeFieldOfView(VREye aEye) = 0;
virtual VRFieldOfView* GetRecommendedEyeFieldOfView(VREye aEye) = 0;
virtual VRFieldOfView* GetMaximumEyeFieldOfView(VREye aEye) = 0;
virtual already_AddRefed<DOMRect> GetRecommendedEyeRenderRect(VREye aEye) = 0;
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;

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

@ -81,12 +81,15 @@ interface HMDVRDevice : VRDevice {
DOMPoint getEyeTranslation(VREye whichEye);
// the FOV that the HMD was configured with
[NewObject]
VRFieldOfView getCurrentEyeFieldOfView(VREye whichEye);
// the recommended FOV, per eye.
[NewObject]
VRFieldOfView getRecommendedEyeFieldOfView(VREye whichEye);
// the maximum FOV, per eye. Above this, rendering will look broken.
[NewObject]
VRFieldOfView getMaximumEyeFieldOfView(VREye whichEye);
// Set a field of view. If either of the fields of view is null,
@ -119,6 +122,7 @@ interface PositionSensorVRDevice : VRDevice {
* to check if the associated members are valid; if these are false, those members
* will be null.
*/
[NewObject]
VRPositionState getState(optional double timeOffset = 0.0);
/* Zero this sensor, treating its current position and orientation