Backed out changeset 30839ee209e8 (bug 901097) for mochitest failures on Android and Mulet. r=backout
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user