Bug 1013097 - Remove IPC for switch event because only the chrome process can receive it. r=dhylands
authorKershaw Chang <kechang@mozilla.com>
Mon, 02 Jun 2014 19:25:00 -0400
changeset 206855 207facf2772f45af12c64882f5d07298ba0bb352
parent 206854 1815c34b697757544b8678b889a7b21593444f25
child 206856 7661bebd6d075b3601edcd675af63f274360c6ac
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1013097
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1013097 - Remove IPC for switch event because only the chrome process can receive it. r=dhylands
hal/Hal.cpp
hal/sandbox/PHal.ipdl
hal/sandbox/SandboxHal.cpp
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -759,16 +759,17 @@ DisableSwitchNotifications(SwitchDevice 
 SwitchState GetCurrentSwitchState(SwitchDevice aDevice)
 {
   AssertMainThread();
   RETURN_PROXY_IF_SANDBOXED(GetCurrentSwitchState(aDevice), SWITCH_STATE_UNKNOWN);
 }
 
 void NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
 {
+  AssertMainThread();
   PROXY_IF_SANDBOXED(NotifySwitchStateFromInputDevice(aDevice, aState));
 }
 
 typedef mozilla::ObserverList<SwitchEvent> SwitchObserverList;
 
 static SwitchObserverList *sSwitchObserverLists = nullptr;
 
 static SwitchObserverList&
--- a/hal/sandbox/PHal.ipdl
+++ b/hal/sandbox/PHal.ipdl
@@ -170,17 +170,16 @@ parent:
     sync LockScreenOrientation(ScreenOrientation aOrientation)
       returns (bool allowed);
     UnlockScreenOrientation();
  
     EnableSwitchNotifications(SwitchDevice aDevice);
     DisableSwitchNotifications(SwitchDevice aDevice);
     sync GetCurrentSwitchState(SwitchDevice aDevice)
       returns (SwitchState aState);
-    NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState);
 
     FactoryReset();
 
 child:
     NotifySensorChange(SensorData aSensorData);
 
 parent:
     EnableSensorNotifications(SensorType aSensor);
--- a/hal/sandbox/SandboxHal.cpp
+++ b/hal/sandbox/SandboxHal.cpp
@@ -339,17 +339,19 @@ GetCurrentSwitchState(SwitchDevice aDevi
   SwitchState state;
   Hal()->SendGetCurrentSwitchState(aDevice, &state);
   return state;
 }
 
 void
 NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState)
 {
-  Hal()->SendNotifySwitchStateFromInputDevice(aDevice, aState);
+  unused << aDevice;
+  unused << aState;
+  NS_RUNTIMEABORT("Only the main process may notify switch state change.");
 }
 
 bool
 EnableAlarm()
 {
   NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts.  Yet.");
   return false;
 }
@@ -857,24 +859,16 @@ public:
   virtual bool
   RecvGetCurrentSwitchState(const SwitchDevice& aDevice, hal::SwitchState *aState) MOZ_OVERRIDE
   {
     // Content has no reason to listen to switch events currently.
     *aState = hal::GetCurrentSwitchState(aDevice);
     return true;
   }
 
-  virtual bool
-  RecvNotifySwitchStateFromInputDevice(const SwitchDevice& aDevice,
-                                       const SwitchState& aState) MOZ_OVERRIDE
-  {
-    hal::NotifySwitchStateFromInputDevice(aDevice, aState);
-    return true;
-  }
-
   void Notify(const int64_t& aClockDeltaMS)
   {
     unused << SendNotifySystemClockChange(aClockDeltaMS);
   }
 
   void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo)
   {
     unused << SendNotifySystemTimezoneChange(aSystemTimezoneChangeInfo);