Bug 624572 - Abort in content process receiving PAudio:SampleOffsetUpdate r=dougt a=blocking-fennec

--HG--
extra : rebase_source : fcc520e461b285763312fc5e977bb187c8f28b7f
This commit is contained in:
Matthew Gregan 2011-01-28 21:40:23 -08:00
parent 46e829073e
commit 3154fd89cc
4 changed files with 28 additions and 18 deletions

View File

@ -287,7 +287,7 @@ class AudioShutdownEvent : public nsRunnable
NS_IMETHOD Run()
{
if (mAudioChild->IsIPCOpen())
PAudioChild::Send__delete__(mAudioChild);
mAudioChild->SendShutdown();
return NS_OK;
}

View File

@ -219,20 +219,10 @@ AudioParent::RecvResume()
}
bool
AudioParent::Recv__delete__()
AudioParent::RecvShutdown()
{
if (mTimer) {
mTimer->Cancel();
mTimer = nsnull;
}
if (mStream) {
nsCOMPtr<nsIRunnable> event = new AudioStreamShutdownEvent(mStream);
nsCOMPtr<nsIThread> thread = mStream->GetThread();
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
mStream = nsnull;
}
Shutdown();
PAudioParent::Send__delete__(this);
return true;
}
@ -261,6 +251,24 @@ void
AudioParent::ActorDestroy(ActorDestroyReason aWhy)
{
mIPCOpen = PR_FALSE;
Shutdown();
}
void
AudioParent::Shutdown()
{
if (mTimer) {
mTimer->Cancel();
mTimer = nsnull;
}
if (mStream) {
nsCOMPtr<nsIRunnable> event = new AudioStreamShutdownEvent(mStream);
nsCOMPtr<nsIThread> thread = mStream->GetThread();
thread->Dispatch(event, nsIEventTarget::DISPATCH_NORMAL);
mStream = nsnull;
}
}
} // namespace dom

View File

@ -71,7 +71,7 @@ class AudioParent : public PAudioParent, public nsITimerCallback
RecvResume();
virtual bool
Recv__delete__();
RecvShutdown();
AudioParent(PRInt32 aNumChannels, PRInt32 aRate, PRInt32 aFormat);
virtual ~AudioParent();
@ -81,6 +81,8 @@ class AudioParent : public PAudioParent, public nsITimerCallback
nsCOMPtr<nsITimer> mTimer;
private:
void Shutdown();
PRPackedBool mIPCOpen;
};
} // namespace dom

View File

@ -48,8 +48,6 @@ protocol PAudio
parent:
__delete__();
Write(nsCString data, PRUint32 count);
SetVolume(float aVolume);
@ -58,13 +56,15 @@ parent:
Pause();
Resume();
Shutdown();
child:
__delete__();
SampleOffsetUpdate(PRInt64 offset, PRInt64 time);
DrainDone();
};
} // namespace dom