Skip to content

Commit 186f4c8

Browse files
committed
Bug 1993981 - Rename MediaTrackGraphImpl::Dispatch to DispatchToMainThread to avoid naming conflicts with nsISerialEventTarget. r=karlt
Differential Revision: https://phabricator.services.mozilla.com/D301275
1 parent 5c0ae53 commit 186f4c8

3 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎dom/media/MediaTrackGraph.cpp‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

27152716
void 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__);

‎dom/media/MediaTrackGraphImpl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class MediaTrackGraphImpl : public MediaTrackGraph,
239239
* Dispatches a runnable from any thread to the correct main thread for this
240240
* MediaTrackGraph.
241241
*/
242-
void Dispatch(already_AddRefed<nsIRunnable> aRunnable);
242+
void DispatchToMainThread(already_AddRefed<nsIRunnable> aRunnable);
243243

244244
/**
245245
* Make this MediaTrackGraph enter forced-shutdown state. This state

‎dom/media/gtest/TestAudioTrackGraph.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ TEST(TestAudioTrackGraph, NonNativeInputTrackStartAndStop)
416416
DeviceInfo info = {mInputTrack->NumberOfChannels(),
417417
mInputTrack->DevicePreference()};
418418
// mHolder.Resolve(info, __func__);
419-
mTrack->GraphImpl()->Dispatch(NS_NewRunnableFunction(
419+
mTrack->GraphImpl()->DispatchToMainThread(NS_NewRunnableFunction(
420420
"TestAudioTrackGraph::DeviceQueryMessage",
421421
[holder = std::move(mHolder), devInfo = info]() mutable {
422422
holder.Resolve(devInfo, __func__);

0 commit comments

Comments
 (0)