Bug 1125030 - Handle VsyncChild shutdown in ActorDestroy(). r=bent

This commit is contained in:
JerryShih
2015-01-29 22:19:00 +01:00
parent 01d4c273bc
commit 00c6a1afac
4 changed files with 25 additions and 8 deletions

View File

@@ -13,6 +13,7 @@ namespace layout {
VsyncChild::VsyncChild()
: mObservingVsync(false)
, mIsShutdown(false)
{
MOZ_ASSERT(NS_IsMainThread());
}
@@ -26,9 +27,9 @@ bool
VsyncChild::SendObserve()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mObservingVsync) {
PVsyncChild::SendObserve();
if (!mObservingVsync && !mIsShutdown) {
mObservingVsync = true;
PVsyncChild::SendObserve();
}
return true;
}
@@ -37,9 +38,9 @@ bool
VsyncChild::SendUnobserve()
{
MOZ_ASSERT(NS_IsMainThread());
if (mObservingVsync) {
PVsyncChild::SendUnobserve();
if (mObservingVsync && !mIsShutdown) {
mObservingVsync = false;
PVsyncChild::SendUnobserve();
}
return true;
}
@@ -48,6 +49,8 @@ void
VsyncChild::ActorDestroy(ActorDestroyReason aActorDestroyReason)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mIsShutdown);
mIsShutdown = true;
mObserver = nullptr;
}
@@ -55,6 +58,7 @@ bool
VsyncChild::RecvNotify(const TimeStamp& aVsyncTimestamp)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(!mIsShutdown);
if (mObservingVsync && mObserver) {
mObserver->NotifyVsync(aVsyncTimestamp);
}