Bug 938809 - Support calling seeking/tuning functions off main thread in HAL, r=dhylands
☠☠ backed out by 72466b921d6b ☠ ☠
authorMichael Wu <mwu@mozilla.com>
Tue, 29 Jul 2014 20:28:12 -0400
changeset 218296 d77f989d6e7dbae1060a385269560766c775276a
parent 218295 c2b8cebd82bdadc28c4093e3e928ee42936538ad
child 218297 b60084fa9d5b974c2507a9826381f792481a71b5
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs938809
milestone34.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 938809 - Support calling seeking/tuning functions off main thread in HAL, r=dhylands
hal/Hal.h
hal/gonk/GonkFMRadio.cpp
--- a/hal/Hal.h
+++ b/hal/Hal.h
@@ -521,26 +521,31 @@ void EnableFMRadio(const hal::FMRadioSet
 /**
  * Disable the FM radio.
  */
 void DisableFMRadio();
 
 /**
  * Seek to an available FM radio station.
  *
+ * This can be called off main thread, but all calls must be completed
+ * before calling DisableFMRadio.
  */
 void FMRadioSeek(const hal::FMRadioSeekDirection& aDirection);
 
 /**
  * Get the current FM radio settings.
  */
 void GetFMRadioSettings(hal::FMRadioSettings* aInfo);
 
 /**
  * Set the FM radio's frequency.
+ *
+ * This can be called off main thread, but all calls must be completed
+ * before calling DisableFMRadio.
  */
 void SetFMRadioFrequency(const uint32_t frequency);
 
 /**
  * Get the FM radio's frequency.
  */
 uint32_t GetFMRadioFrequency();
 
--- a/hal/gonk/GonkFMRadio.cpp
+++ b/hal/gonk/GonkFMRadio.cpp
@@ -397,30 +397,28 @@ FMRadioSeek(const hal::FMRadioSeekDirect
 #else
   seek.spacing = sRadioSettings.spaceType() * 1000;
 #endif
 
   int rc = ioctl(sRadioFD, VIDIOC_S_HW_FREQ_SEEK, &seek);
   if (sMsmFMMode && rc >= 0)
     return;
 
-  hal::FMRadioOperationInformation info;
-  info.operation() = hal::FM_RADIO_OPERATION_SEEK;
-  info.status() = rc < 0 ? hal::FM_RADIO_OPERATION_STATUS_FAIL :
-                           hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-  hal::NotifyFMRadioStatus(info);
+  NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_SEEK,
+                                          rc < 0 ?
+                                          FM_RADIO_OPERATION_STATUS_FAIL :
+                                          FM_RADIO_OPERATION_STATUS_SUCCESS));
 
   if (rc < 0) {
     HAL_LOG(("Could not initiate hardware seek"));
     return;
   }
 
-  info.operation() = hal::FM_RADIO_OPERATION_TUNE;
-  info.status() = hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-  hal::NotifyFMRadioStatus(info);
+  NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_TUNE,
+                                          FM_RADIO_OPERATION_STATUS_SUCCESS));
 }
 
 void
 GetFMRadioSettings(hal::FMRadioSettings* aInfo)
 {
   if (!sRadioEnabled) {
     return;
   }
@@ -445,21 +443,20 @@ SetFMRadioFrequency(const uint32_t frequ
 
   int rc = ioctl(sRadioFD, VIDIOC_S_FREQUENCY, &freq);
   if (rc < 0)
     HAL_LOG(("Could not set radio frequency"));
 
   if (sMsmFMMode && rc >= 0)
     return;
 
-  hal::FMRadioOperationInformation info;
-  info.operation() = hal::FM_RADIO_OPERATION_TUNE;
-  info.status() = rc < 0 ? hal::FM_RADIO_OPERATION_STATUS_FAIL :
-                           hal::FM_RADIO_OPERATION_STATUS_SUCCESS;
-  hal::NotifyFMRadioStatus(info);
+  NS_DispatchToMainThread(new RadioUpdate(FM_RADIO_OPERATION_TUNE,
+                                          rc < 0 ?
+                                          FM_RADIO_OPERATION_STATUS_FAIL :
+                                          FM_RADIO_OPERATION_STATUS_SUCCESS));
 }
 
 uint32_t
 GetFMRadioFrequency()
 {
   if (!sRadioEnabled)
     return 0;