mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 938809 - Run seek/tune calls off the main thread, r=pzhang,khuey
This commit is contained in:
parent
68f5b67b31
commit
efbe89d0cf
@ -135,6 +135,13 @@ public:
|
||||
|
||||
EnableFMRadio(info);
|
||||
|
||||
FMRadioService* fmRadioService = FMRadioService::Singleton();
|
||||
if (!fmRadioService->mTuneThread) {
|
||||
// SeekRunnable and SetFrequencyRunnable run on this thread.
|
||||
// These call ioctls that can stall the main thread, so we run them here.
|
||||
NS_NewNamedThread("FM Tuning", getter_AddRefs(fmRadioService->mTuneThread));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -214,10 +221,15 @@ public:
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
FMRadioService* fmRadioService = FMRadioService::Singleton();
|
||||
if (fmRadioService->mTuneThread) {
|
||||
fmRadioService->mTuneThread->Shutdown();
|
||||
fmRadioService->mTuneThread = nullptr;
|
||||
}
|
||||
// Fix Bug 796733. DisableFMRadio should be called before
|
||||
// SetFmRadioAudioEnabled to prevent the annoying beep sound.
|
||||
DisableFMRadio();
|
||||
IFMRadioService::Singleton()->EnableAudio(false);
|
||||
fmRadioService->EnableAudio(false);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -298,7 +310,7 @@ FMRadioService::RemoveObserver(FMRadioEventObserver* aObserver)
|
||||
{
|
||||
// Turning off the FM radio HW because observer list is empty.
|
||||
if (IsFMRadioOn()) {
|
||||
NS_DispatchToMainThread(new DisableRunnable());
|
||||
DoDisable();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -595,7 +607,8 @@ FMRadioService::SetFrequency(double aFrequencyInMHz,
|
||||
return;
|
||||
}
|
||||
|
||||
NS_DispatchToMainThread(new SetFrequencyRunnable(roundedFrequency));
|
||||
mTuneThread->Dispatch(new SetFrequencyRunnable(roundedFrequency),
|
||||
nsIThread::DISPATCH_NORMAL);
|
||||
|
||||
aReplyRunnable->SetReply(SuccessResponse());
|
||||
NS_DispatchToMainThread(aReplyRunnable);
|
||||
@ -636,7 +649,7 @@ FMRadioService::Seek(FMRadioSeekDirection aDirection,
|
||||
SetState(Seeking);
|
||||
mPendingRequest = aReplyRunnable;
|
||||
|
||||
NS_DispatchToMainThread(new SeekRunnable(aDirection));
|
||||
mTuneThread->Dispatch(new SeekRunnable(aDirection), nsIThread::DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -141,7 +141,8 @@ class FMRadioService MOZ_FINAL : public IFMRadioService
|
||||
, public nsIObserver
|
||||
{
|
||||
friend class ReadAirplaneModeSettingTask;
|
||||
friend class SetFrequencyRunnable;
|
||||
friend class EnableRunnable;
|
||||
friend class DisableRunnable;
|
||||
|
||||
public:
|
||||
static FMRadioService* Singleton();
|
||||
@ -202,6 +203,7 @@ private:
|
||||
uint32_t mChannelWidthInKHz;
|
||||
uint32_t mPreemphasis;
|
||||
|
||||
nsCOMPtr<nsIThread> mTuneThread;
|
||||
nsRefPtr<FMRadioReplyRunnable> mPendingRequest;
|
||||
|
||||
FMRadioEventObserverList mObserverList;
|
||||
|
Loading…
Reference in New Issue
Block a user