Bug 1704500: Make UtilityActorName an alias for WebIDLUtilityActorName r=gerard-majax

This eliminates a redundant enum that we had to keep synchronized with another.

Depends on D155020

Differential Revision: https://phabricator.services.mozilla.com/D162943
This commit is contained in:
David Parks 2023-01-25 02:48:57 +00:00
Родитель 47dbc5bd8f
Коммит 3b5a94ae42
4 изменённых файлов: 4 добавлений и 46 удалений

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

@ -1063,36 +1063,6 @@ static WebIDLProcType ProcTypeToWebIDL(mozilla::ProcType aType) {
#undef PROCTYPE_TO_WEBIDL_CASE
#define UTILITYACTORNAME_TO_WEBIDL_CASE(_utilityActorName, _webidl) \
case mozilla::UtilityActorName::_utilityActorName: \
return WebIDLUtilityActorName::_webidl
static WebIDLUtilityActorName UtilityActorNameToWebIDL(
mozilla::UtilityActorName aType) {
// Max is the value of the last enum, not the length, so add one.
static_assert(WebIDLUtilityActorNameValues::Count ==
static_cast<size_t>(UtilityActorName::WindowsUtils) + 1,
"In order for this static cast to be okay, "
"UtilityActorName must match UtilityActorName exactly");
// These must match the similar ones in ProcInfo.h and ChromeUtils.webidl
switch (aType) {
UTILITYACTORNAME_TO_WEBIDL_CASE(Unknown, Unknown);
UTILITYACTORNAME_TO_WEBIDL_CASE(AudioDecoder_Generic, AudioDecoder_Generic);
UTILITYACTORNAME_TO_WEBIDL_CASE(AudioDecoder_AppleMedia,
AudioDecoder_AppleMedia);
UTILITYACTORNAME_TO_WEBIDL_CASE(AudioDecoder_WMF, AudioDecoder_WMF);
UTILITYACTORNAME_TO_WEBIDL_CASE(MfMediaEngineCDM, MfMediaEngineCDM);
UTILITYACTORNAME_TO_WEBIDL_CASE(JSOracle, JSOracle);
UTILITYACTORNAME_TO_WEBIDL_CASE(WindowsUtils, WindowsUtils);
}
MOZ_ASSERT(false, "Unhandled case in WebIDLUtilityActorName");
return WebIDLUtilityActorName::Unknown;
}
#undef UTILITYACTORNAME_TO_WEBIDL_CASE
/* static */
already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
ErrorResult& aRv) {
@ -1377,8 +1347,7 @@ already_AddRefed<Promise> ChromeUtils::RequestProcInfo(GlobalObject& aGlobal,
return;
}
dest->mActorName =
UtilityActorNameToWebIDL(source.actorName);
dest->mActorName = source.actorName;
}
}
}

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

@ -42,10 +42,6 @@ implementing the trivial example visible in `EmptyUtil
+ Add member within `enum WebIDLUtilityActorName in <https://searchfox.org/mozilla-central/rev/fb511723f821ceabeea23b123f1c50c9e93bde9d/dom/chrome-webidl/ChromeUtils.webidl#686-689>`_
+ Add member within `enum class UtilityActorName of <https://searchfox.org/mozilla-central/rev/fb511723f821ceabeea23b123f1c50c9e93bde9d/toolkit/components/processtools/ProcInfo.h#71-74>`_
+ Update mapping in `switch case <https://searchfox.org/mozilla-central/rev/fb511723f821ceabeea23b123f1c50c9e93bde9d/dom/base/ChromeUtils.cpp#916-919>`_ and update the `static assert <https://searchfox.org/mozilla-central/rev/fb511723f821ceabeea23b123f1c50c9e93bde9d/dom/base/ChromeUtils.cpp#910-911>`_
- Handle reception of ``StartEmptyUtilService`` on the child side of
``UtilityProcess`` within ``RecvStartEmptyUtilService()``

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

@ -68,15 +68,7 @@ enum class ProcType {
Max = Unknown,
};
enum class UtilityActorName {
Unknown,
AudioDecoder_Generic,
AudioDecoder_AppleMedia,
AudioDecoder_WMF,
MfMediaEngineCDM,
JSOracle,
WindowsUtils,
};
using UtilityActorName = mozilla::dom::WebIDLUtilityActorName;
// String that will be used e.g. to annotate crash reports
nsCString GetUtilityActorName(const UtilityActorName aActorName);

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

@ -57,8 +57,9 @@ nsCString GetUtilityActorName(const UtilityActorName aActorName) {
return "js-oracle"_ns;
case UtilityActorName::WindowsUtils:
return "windows-utils"_ns;
default:
return "unknown"_ns;
}
return "unknown"_ns;
}
} // namespace mozilla