Bug 1914034 - Expose wrapped runnable name in ExternalRunnableWrapper::GetName and WrappedControlRunnable::GetName r=nika

Differential Revision: https://phabricator.services.mozilla.com/D219687
This commit is contained in:
Steve Fink 2024-08-22 19:29:22 +00:00
parent f63124b846
commit a503acdd23
2 changed files with 30 additions and 0 deletions

View File

@ -67,6 +67,21 @@ class WrappedControlRunnable final : public WorkerControlRunnable {
// Cancel() being called.
return cr->Cancel();
}
#ifdef MOZ_COLLECTING_RUNNABLE_TELEMETRY
NS_IMETHOD GetName(nsACString& aName) override {
aName.AssignLiteral("WrappedControlRunnable(");
if (nsCOMPtr<nsINamed> named = do_QueryInterface(mInner)) {
nsAutoCString containedName;
named->GetName(containedName);
aName.Append(containedName);
} else {
aName.AppendLiteral("?");
}
aName.AppendLiteral(")");
return NS_OK;
}
#endif
};
} // anonymous namespace

View File

@ -237,6 +237,21 @@ class ExternalRunnableWrapper final : public WorkerThreadRunnable {
mWrappedRunnable = nullptr;
return NS_OK;
}
#ifdef MOZ_COLLECTING_RUNNABLE_TELEMETRY
NS_IMETHOD GetName(nsACString& aName) override {
aName.AssignLiteral("ExternalRunnableWrapper(");
if (nsCOMPtr<nsINamed> named = do_QueryInterface(mWrappedRunnable)) {
nsAutoCString containedName;
named->GetName(containedName);
aName.Append(containedName);
} else {
aName.AppendLiteral("?");
}
aName.AppendLiteral(")");
return NS_OK;
}
#endif
};
struct WindowAction {