Bug 1143823 part 1: Make MediaStream::RunAfterPendingUpdates() take already_AddRefed instead of a nsRefPtr. r=karlt

This commit is contained in:
Daniel Holbert 2015-03-17 09:29:17 -07:00
parent f46b3c2dec
commit c4a0036a5d
2 changed files with 5 additions and 4 deletions

View File

@ -2203,15 +2203,16 @@ MediaStream::RemoveListener(MediaStreamListener* aListener)
}
void
MediaStream::RunAfterPendingUpdates(nsRefPtr<nsIRunnable> aRunnable)
MediaStream::RunAfterPendingUpdates(already_AddRefed<nsIRunnable> aRunnable)
{
MOZ_ASSERT(NS_IsMainThread());
MediaStreamGraphImpl* graph = GraphImpl();
nsCOMPtr<nsIRunnable> runnable(aRunnable);
// Special case when a non-realtime graph has not started, to ensure the
// runnable will run in finite time.
if (!(graph->mRealtime || graph->mNonRealtimeProcessing)) {
aRunnable->Run();
runnable->Run();
}
class Message : public ControlMessage {
@ -2236,7 +2237,7 @@ MediaStream::RunAfterPendingUpdates(nsRefPtr<nsIRunnable> aRunnable)
nsRefPtr<nsIRunnable> mRunnable;
};
graph->AppendMessage(new Message(this, aRunnable.forget()));
graph->AppendMessage(new Message(this, runnable.forget()));
}
void

View File

@ -397,7 +397,7 @@ public:
*
* Main thread only.
*/
void RunAfterPendingUpdates(nsRefPtr<nsIRunnable> aRunnable);
void RunAfterPendingUpdates(already_AddRefed<nsIRunnable> aRunnable);
// Signal that the client is done with this MediaStream. It will be deleted later.
virtual void Destroy();