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
parent d1637b9c5a
commit 8fb9da1035

View File

@ -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;
}