Bug 734855 - Rename DeviceMotion to DeviceSensors. Review comments address r=mwu

This commit is contained in:
Doug Turner 2012-03-24 17:30:03 -07:00
parent d24b5a906e
commit 59d0282757
4 changed files with 11 additions and 6 deletions

View File

@ -37,6 +37,10 @@
#include "mozilla/Hal.h"
#include "mozilla/HalSensor.h"
// Microsoft's API Name hackery sucks
#undef CreateEvent
#include "nsISupports.h"
#include "nsGUIEvent.h"
#include "nsDOMEvent.h"

View File

@ -519,7 +519,6 @@ public:
virtual void EnableDeviceSensor(PRUint32 aType);
virtual void DisableDeviceSensor(PRUint32 aType);
nsTArray<PRUint32> mEnabledSensors;
virtual nsresult SetArguments(nsIArray *aArguments, nsIPrincipal *aOrigin);
@ -990,6 +989,8 @@ protected:
nsTHashtable<nsPtrHashKey<nsDOMEventTargetHelper> > mEventTargetObjects;
nsTArray<PRUint32> mEnabledSensors;
friend class nsDOMScriptableHelper;
friend class nsDOMWindowUtils;
friend class PostMessageEvent;

View File

@ -173,14 +173,17 @@ NS_IMETHODIMP nsDeviceSensors::RemoveWindowListener(PRUint32 aType, nsIDOMWindow
return NS_OK;
mWindowListeners[aType]->RemoveElement(aWindow);
if (mWindowListeners[aType]->Length() == 0)
UnregisterSensorObserver((SensorType)aType, this);
return NS_OK;
}
NS_IMETHODIMP nsDeviceSensors::RemoveWindowAsListener(nsIDOMWindow *aWindow)
{
for (int i = 0; i < NUM_SENSOR_TYPE; i++) {
if (IsSensorEnabled(i))
RemoveWindowListener((SensorType)i, aWindow);
RemoveWindowListener((SensorType)i, aWindow);
}
return NS_OK;
}

View File

@ -74,9 +74,6 @@ private:
// sensor -> window listener
nsTArray<nsTArray<nsIDOMWindow*>* > mWindowListeners;
// window -> sensortype enabled
nsDataHashtable<nsUint32HashKey, nsTArray<PRUint32 > > mSensorsEnabled;
void FireDOMOrientationEvent(class nsIDOMDocument *domDoc,
class nsIDOMEventTarget *target,
double alpha,