Bug 1339588 - Part 1: Simplify nsTimerEvent::Cancel, since there's no need to release the nsTimerImpl itself. r=froydnj

MozReview-Commit-ID: 6br6DaDqxR0

--HG--
extra : rebase_source : 13cde860824483332c42ac2f86bca722bf42d36b
extra : source : 47a3ac382469cb8bd4cdfa123457a6d6b4f11d39
This commit is contained in:
Byron Campen [:bwc] 2017-02-14 15:29:01 -06:00
Родитель 43f8cee68d
Коммит ada35c9a53
1 изменённых файлов: 2 добавлений и 13 удалений

Просмотреть файл

@ -141,11 +141,7 @@ public:
nsresult 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;
mTimer->Cancel();
return NS_OK;
}
@ -282,11 +278,6 @@ nsTimerEvent::GetName(nsACString& aName)
NS_IMETHODIMP
nsTimerEvent::Run()
{
if (!mTimer) {
MOZ_ASSERT(false);
return NS_OK;
}
if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) {
TimeStamp now = TimeStamp::Now();
MOZ_LOG(GetTimerLog(), LogLevel::Debug,
@ -296,9 +287,7 @@ nsTimerEvent::Run()
mTimer->Fire(mGeneration);
// We call Cancel() to correctly release mTimer.
// Read more in the Cancel() implementation.
return Cancel();
return NS_OK;
}
nsresult