Backed out changeset 6dc016256eba (bug 1378067) for bustage at dom/media/webaudio/WebAudioUtils.cpp:107. r=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-07-18 11:51:22 +02:00
parent ac12821115
commit cb2227a5c7
7 changed files with 22 additions and 33 deletions

View File

@ -425,7 +425,7 @@ void InitLibrary()
Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_BACKEND);
Preferences::RegisterCallbackAndCall(PrefChanged, PREF_CUBEB_LOG_LEVEL);
#ifndef MOZ_WIDGET_ANDROID
AbstractThread::MainThread()->Dispatch(
NS_DispatchToMainThread(
NS_NewRunnableFunction("CubebUtils::InitLibrary", &InitBrandName));
#endif
}

View File

@ -147,9 +147,8 @@ public:
void Forget() { mStream = nullptr; }
void DoNotifyTrackCreated(MediaStreamGraph* aGraph, TrackID aTrackID,
MediaSegment::Type aType, MediaStream* aInputStream,
TrackID aInputTrackID)
void DoNotifyTrackCreated(TrackID aTrackID, MediaSegment::Type aType,
MediaStream* aInputStream, TrackID aInputTrackID)
{
MOZ_ASSERT(NS_IsMainThread());
@ -187,15 +186,15 @@ public:
RefPtr<MediaStreamTrack> newTrack =
mStream->CreateDOMTrack(aTrackID, aType, source);
aGraph->AbstractMainThread()->Dispatch(NewRunnableMethod<RefPtr<MediaStreamTrack>>(
NS_DispatchToMainThread(NewRunnableMethod<RefPtr<MediaStreamTrack>>(
"DOMMediaStream::AddTrackInternal",
mStream,
&DOMMediaStream::AddTrackInternal,
newTrack));
}
void DoNotifyTrackEnded(MediaStreamGraph* aGraph, MediaStream* aInputStream,
TrackID aInputTrackID, TrackID aTrackID)
void DoNotifyTrackEnded(MediaStream* aInputStream, TrackID aInputTrackID,
TrackID aTrackID)
{
MOZ_ASSERT(NS_IsMainThread());
@ -209,7 +208,7 @@ public:
if (track) {
LOG(LogLevel::Debug, ("DOMMediaStream %p MediaStreamTrack %p ended at the source. Marking it ended.",
mStream, track.get()));
aGraph->AbstractMainThread()->Dispatch(
NS_DispatchToMainThread(
NewRunnableMethod("dom::MediaStreamTrack::OverrideEnded",
track,
&MediaStreamTrack::OverrideEnded));
@ -224,25 +223,23 @@ public:
{
if (aTrackEvents & TrackEventCommand::TRACK_EVENT_CREATED) {
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
NewRunnableMethod<MediaStreamGraph*, TrackID,
NewRunnableMethod<TrackID,
MediaSegment::Type,
RefPtr<MediaStream>,
TrackID>(
"DOMMediaStream::OwnedStreamListener::DoNotifyTrackCreated",
this,
&OwnedStreamListener::DoNotifyTrackCreated,
aGraph,
aID,
aQueuedMedia.GetType(),
aInputStream,
aInputTrackID));
} else if (aTrackEvents & TrackEventCommand::TRACK_EVENT_ENDED) {
aGraph->DispatchToMainThreadAfterStreamStateUpdate(
NewRunnableMethod<MediaStreamGraph*, RefPtr<MediaStream>, TrackID, TrackID>(
NewRunnableMethod<RefPtr<MediaStream>, TrackID, TrackID>(
"DOMMediaStream::OwnedStreamListener::DoNotifyTrackEnded",
this,
&OwnedStreamListener::DoNotifyTrackEnded,
aGraph,
aInputStream,
aInputTrackID,
aID));
@ -282,8 +279,7 @@ public:
// The owned stream listener adds its tracks after another main thread
// dispatch. We have to do the same to notify of created tracks to stay
// in sync. (Or NotifyTracksCreated is called before tracks are added).
MOZ_ASSERT(mStream->GetPlaybackStream());
mStream->GetPlaybackStream()->Graph()->AbstractMainThread()->Dispatch(
NS_DispatchToMainThread(
NewRunnableMethod("DOMMediaStream::NotifyTracksCreated",
mStream,
&DOMMediaStream::NotifyTracksCreated));
@ -297,10 +293,9 @@ public:
return;
}
mStream->GetPlaybackStream()->Graph()->AbstractMainThread()->Dispatch(
NewRunnableMethod("DOMMediaStream::NotifyFinished",
mStream,
&DOMMediaStream::NotifyFinished));
NS_DispatchToMainThread(NewRunnableMethod("DOMMediaStream::NotifyFinished",
mStream,
&DOMMediaStream::NotifyFinished));
}
// The methods below are called on the MediaStreamGraph thread.

View File

@ -165,10 +165,9 @@ ThreadedDriver::~ThreadedDriver()
if (mThread) {
nsCOMPtr<nsIRunnable> event =
new MediaStreamGraphShutdownThreadRunnable(mThread.forget());
GraphImpl()->Dispatch(event.forget());
NS_DispatchToMainThread(event);
}
}
class MediaStreamGraphInitThreadRunnable : public Runnable {
public:
explicit MediaStreamGraphInitThreadRunnable(ThreadedDriver* aDriver)
@ -494,11 +493,10 @@ AsyncCubebTask::EnsureThread()
// since we don't know the order that the shutdown-threads observers
// will run. ClearOnShutdown guarantees it runs first.
if (!NS_IsMainThread()) {
nsCOMPtr<nsIRunnable> runnable =
NS_DispatchToMainThread(
NS_NewRunnableFunction("AsyncCubebTask::EnsureThread", []() -> void {
ClearOnShutdown(&sThreadPool, ShutdownPhase::ShutdownThreads);
});
AbstractThread::MainThread()->Dispatch(runnable.forget());
}));
} else {
ClearOnShutdown(&sThreadPool, ShutdownPhase::ShutdownThreads);
}

View File

@ -177,8 +177,7 @@ public:
refchanged.forget());
} else { // Help people diagnose bug 924718
WebAudioUtils::LogToDeveloperConsole(mWindowID,
"BiquadFilterChannelCountChangeWarning",
aStream->Graph()->AbstractMainThread());
"BiquadFilterChannelCountChangeWarning");
}
// Adjust the number of biquads based on the number of channels

View File

@ -73,8 +73,7 @@ public:
refchanged.forget());
} else {
WebAudioUtils::LogToDeveloperConsole(mWindowID,
"IIRFilterChannelCountChangeWarning",
aStream->Graph()->AbstractMainThread());
"IIRFilterChannelCountChangeWarning");
}
// Adjust the number of filters based on the number of channels

View File

@ -94,8 +94,7 @@ WebAudioUtils::SpeexResamplerProcess(SpeexResamplerState* aResampler,
}
void
WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID, const char* aKey,
AbstractThread* aMainThread)
WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID, const char* aKey)
{
// This implementation is derived from dom/media/VideoUtils.cpp, but we
// use a windowID so that the message is delivered to the developer console.
@ -104,8 +103,8 @@ WebAudioUtils::LogToDeveloperConsole(uint64_t aWindowID, const char* aKey,
if (!NS_IsMainThread()) {
nsCOMPtr<nsIRunnable> task = NS_NewRunnableFunction(
"dom::WebAudioUtils::LogToDeveloperConsole",
[aWindowID, aKey, aMainThread]() { LogToDeveloperConsole(aWindowID, aKey, aMainThread); });
aMainThread->Dispatch(task.forget(), NS_DISPATCH_NORMAL);
[aWindowID, aKey]() { LogToDeveloperConsole(aWindowID, aKey); });
NS_DispatchToMainThread(task.forget(), NS_DISPATCH_NORMAL);
return;
}

View File

@ -229,8 +229,7 @@ namespace WebAudioUtils {
int16_t* aOut, uint32_t* aOutLen);
void
LogToDeveloperConsole(uint64_t aWindowID, const char* aKey,
AbstractThread* aMainThread);
LogToDeveloperConsole(uint64_t aWindowID, const char* aKey);
} // namespace WebAudioUtils