Backed out changeset 30839ee209e8 (bug 901097) for mochitest failures on Android and Mulet. r=backout

This commit is contained in:
Sebastian Hengst
2015-12-17 14:13:59 +01:00
parent 730fa6bae5
commit 012bf5fb95
13 changed files with 206 additions and 808 deletions

View File

@@ -127,23 +127,10 @@ public:
} // namespace
// This is a nsICancelableRunnable because we can dispatch it to Workers and
// those can be shut down at any time, and in these cases, Cancel() is called
// instead of Run().
class nsTimerEvent : public nsCancelableRunnable
class nsTimerEvent : public nsRunnable
{
public:
NS_IMETHOD Run() override;
NS_IMETHOD Cancel() override
{
// Since nsTimerImpl is not thread-safe, we should release |mTimer|
// here in the target thread to avoid race condition. Otherwise,
// ~nsTimerEvent() which calls nsTimerImpl::Release() could run in the
// timer thread and result in race condition.
mTimer = nullptr;
return NS_OK;
}
NS_IMETHOD Run();
nsTimerEvent()
: mTimer()
@@ -266,8 +253,6 @@ nsTimerEvent::DeleteAllocatorIfNeeded()
NS_IMETHODIMP
nsTimerEvent::Run()
{
MOZ_ASSERT(mTimer);
if (mGeneration != mTimer->GetGeneration()) {
return NS_OK;
}
@@ -280,10 +265,13 @@ nsTimerEvent::Run()
}
mTimer->Fire();
// Since nsTimerImpl is not thread-safe, we should release |mTimer|
// here in the target thread to avoid race condition. Otherwise,
// ~nsTimerEvent() which calls nsTimerImpl::Release() could run in the
// timer thread and result in race condition.
mTimer = nullptr;
// We call Cancel() to correctly release mTimer.
// Read more in the Cancel() implementation.
return Cancel();
return NS_OK;
}
nsresult