Bug 1672369 - Change infallible TypeToText to use a return value and remove unused variant. r=dom-workers-and-storage-reviewers,ttung,janv

Differential Revision: https://phabricator.services.mozilla.com/D94319
This commit is contained in:
Simon Giesecke 2020-11-30 10:47:02 +00:00
Родитель 257530e1da
Коммит f0fab90073
3 изменённых файлов: 10 добавлений и 21 удалений

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

@ -3053,13 +3053,10 @@ void DirectoryLockImpl::Log() const {
}
QM_LOG((" mOriginScope: %s", originScope.get()));
nsString clientType;
if (mClientType.IsNull()) {
clientType.AssignLiteral("null");
} else {
Client::TypeToText(mClientType.Value(), clientType);
}
QM_LOG((" mClientType: %s", NS_ConvertUTF16toUTF8(clientType).get()));
const auto clientType = mClientType.IsNull()
? nsAutoCString{"null"_ns}
: Client::TypeToText(mClientType.Value());
QM_LOG((" mClientType: %s", clientType.get()));
nsCString blockedOnString;
for (auto blockedOn : mBlockedOn) {

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

@ -204,17 +204,12 @@ bool Client::TypeToText(Type aType, nsAString& aText, const fallible_t&) {
}
// static
void Client::TypeToText(Type aType, nsAString& aText) {
if (!TypeTo_impl(aType, aText)) {
BadType();
}
}
// static
void Client::TypeToText(Type aType, nsACString& aText) {
if (!TypeTo_impl(aType, aText)) {
nsAutoCString Client::TypeToText(Type aType) {
nsAutoCString res;
if (!TypeTo_impl(aType, res)) {
BadType();
}
return res;
}
// static
@ -276,8 +271,7 @@ void Client::ShutdownWorkThreads() {
MOZ_DIAGNOSTIC_ASSERT(!quotaClient->IsShutdownCompleted());
nsAutoCString type;
TypeToText(quotaClient->GetType(), type);
const auto type = TypeToText(quotaClient->GetType());
CrashReporter::AnnotateCrashReport(
CrashReporter::Annotation::QuotaManagerShutdownTimeout,

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

@ -68,9 +68,7 @@ class Client {
static bool TypeToText(Type aType, nsAString& aText, const fallible_t&);
static void TypeToText(Type aType, nsAString& aText);
static void TypeToText(Type aType, nsACString& aText);
static nsAutoCString TypeToText(Type aType);
static bool TypeFromText(const nsAString& aText, Type& aType,
const fallible_t&);