@@ -1015,7 +1015,7 @@ void MediaTrackGraphImpl::DeviceChanged() {
10151015 NS_DispatchBackgroundTask (NS_NewRunnableFunction(
10161016 " MaxChannelCountUpdateOnBgThread" , [self{std::move (self)}]() {
10171017 uint32_t maxChannelCount = CubebUtils::MaxNumberOfChannels ();
1018- self->Dispatch (NS_NewRunnableFunction(
1018+ self->DispatchToMainThread (NS_NewRunnableFunction(
10191019 " MaxChannelCountUpdateToMainThread" ,
10201020 [self{self}, maxChannelCount]() {
10211021 class MessageToGraph : public ControlMessage {
@@ -2143,7 +2143,8 @@ void MediaTrackGraphImpl::AppendMessage(
21432143 EnsureRunInStableState ();
21442144}
21452145
2146- void MediaTrackGraphImpl::Dispatch (already_AddRefed<nsIRunnable> aRunnable) {
2146+ void MediaTrackGraphImpl::DispatchToMainThread (
2147+ already_AddRefed<nsIRunnable> aRunnable) {
21472148 mMainThread ->Dispatch (std::move (aRunnable));
21482149}
21492150
@@ -2645,7 +2646,7 @@ void MediaTrack::RunAfterPendingUpdates(
26452646 // assume that there are no remaining
26462647 // controlMessagesToRunDuringShutdown.
26472648 MOZ_ASSERT (NS_IsMainThread());
2648- GraphImpl ()->Dispatch (runnable.forget ());
2649+ GraphImpl ()->DispatchToMainThread (runnable.forget ());
26492650 }
26502651 });
26512652}
@@ -2709,7 +2710,7 @@ void MediaTrack::AddMainThreadListener(
27092710 };
27102711
27112712 nsCOMPtr<nsIRunnable> runnable = new NotifyRunnable (this );
2712- GraphImpl ()->Dispatch (runnable.forget ());
2713+ GraphImpl ()->DispatchToMainThread (runnable.forget ());
27132714}
27142715
27152716void MediaTrack::AdvanceTimeVaryingValuesToCurrentTime (GraphTime aCurrentTime,
@@ -3867,7 +3868,7 @@ void MediaTrackGraphImpl::NotifyWhenPrimaryDeviceStarted(
38673868 CurrentDriver ()->ThreadRunning () &&
38683869 !CurrentDriver ()->AsAudioCallbackDriver ()->OnFallback ()) {
38693870 // Avoid Resolve's locking on the graph thread by doing it on main.
3870- Dispatch (NS_NewRunnableFunction(
3871+ DispatchToMainThread (NS_NewRunnableFunction(
38713872 " MediaTrackGraphImpl::NotifyWhenPrimaryDeviceStarted::Resolver" ,
38723873 [holder = std::move (holder)]() mutable {
38733874 holder.Resolve (true , __func__);
0 commit comments