Bug 1331804 - Give runnable names to some generic dispatch sites (r=ehsan)

MozReview-Commit-ID: 83IL5zcor1W
This commit is contained in:
Bill McCloskey 2017-01-18 14:01:05 -08:00
Родитель ef3d0f1c2e
Коммит cf9eef1ea4
2 изменённых файлов: 11 добавлений и 3 удалений

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

@ -4747,7 +4747,11 @@ nsresult
WorkerPrivate::DispatchToMainThread(already_AddRefed<nsIRunnable> aRunnable,
uint32_t aFlags)
{
return mMainThreadEventTarget->Dispatch(Move(aRunnable), aFlags);
nsCOMPtr<nsIRunnable> runnable = aRunnable;
if (nsCOMPtr<nsINamed> named = do_QueryInterface(runnable)) {
named->SetName("WorkerRunnable");
}
return mMainThreadEventTarget->Dispatch(runnable.forget(), aFlags);
}
void

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

@ -663,24 +663,28 @@ nsTimerImpl::GetName(nsACString& aName)
aName.Assign(buf);
} else {
MOZ_ASSERT(mName.is<NameNothing>());
aName.Truncate();
aName.AssignLiteral("Anonymous callback timer");
}
break;
case CallbackType::Interface:
if (nsCOMPtr<nsINamed> named = do_QueryInterface(mCallback.i)) {
named->GetName(aName);
} else {
aName.AssignLiteral("Anonymous interface timer");
}
break;
case CallbackType::Observer:
if (nsCOMPtr<nsINamed> named = do_QueryInterface(mCallback.o)) {
named->GetName(aName);
} else {
aName.AssignLiteral("Anonymous observer timer");
}
break;
case CallbackType::Unknown:
aName.Truncate();
aName.AssignLiteral("Anonymous timer");
break;
}
}