Bug 1372405 - Change SchedulerGroup::GetName so it doesn't delegate to mozilla::Runnable (r=froydnj)

Delegating to mozilla::Runnable caused us to return the wrong value once
SchedulerGroup started passing a non-empty name to the Runnable constructor.

MozReview-Commit-ID: 2zMlpiMnHwv
This commit is contained in:
Bill McCloskey 2017-06-15 16:26:25 -07:00
Родитель 6d992ced50
Коммит 3c1581f160
1 изменённых файлов: 8 добавлений и 10 удалений

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

@ -339,17 +339,15 @@ SchedulerGroup::Runnable::Runnable(already_AddRefed<nsIRunnable>&& aRunnable,
NS_IMETHODIMP
SchedulerGroup::Runnable::GetName(nsACString& aName)
{
mozilla::Runnable::GetName(aName);
if (aName.IsEmpty()) {
// Try to get a name from the underlying runnable.
nsCOMPtr<nsINamed> named = do_QueryInterface(mRunnable);
if (named) {
named->GetName(aName);
}
if (aName.IsEmpty()) {
aName.AssignLiteral("anonymous");
}
// Try to get a name from the underlying runnable.
nsCOMPtr<nsINamed> named = do_QueryInterface(mRunnable);
if (named) {
named->GetName(aName);
}
if (aName.IsEmpty()) {
aName.AssignLiteral("anonymous");
}
aName.AppendASCII("(labeled)");
return NS_OK;
}