Bug 1832108 - Collect Utility audio decoder actor name r=padenot

Differential Revision: https://phabricator.services.mozilla.com/D177516
This commit is contained in:
Alexandre Lissy 2023-05-10 09:34:15 +00:00
Родитель fa8e7435cf
Коммит dfe03ada47
5 изменённых файлов: 72 добавлений и 21 удалений

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

@ -22,6 +22,7 @@
# include "mozilla/TaskQueue.h"
# include "mozilla/layers/KnowsCompositor.h"
# include "mozilla/layers/LayersTypes.h"
# include "mozilla/ipc/UtilityAudioDecoder.h"
# include "nsTArray.h"
# include "PerformanceRecorder.h"
@ -524,7 +525,11 @@ class MediaDataDecoder : public DecoderDoctorLifeLogger<MediaDataDecoder> {
virtual nsCString GetDescriptionName() const = 0;
virtual nsCString GetProcessName() const {
return nsCString(XRE_GetProcessTypeString());
nsCString rv = nsCString(XRE_GetProcessTypeString());
if (XRE_IsUtilityProcess()) {
rv += "+"_ns + mozilla::ipc::GetChildAudioActorName();
}
return rv;
};
virtual nsCString GetCodecName() const = 0;

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

@ -0,0 +1,41 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ProcInfo.h"
#include "mozilla/ipc/UtilityAudioDecoder.h"
#include "mozilla/ipc/UtilityProcessChild.h"
namespace mozilla::ipc {
UtilityActorName GetAudioActorName(const SandboxingKind aSandbox) {
switch (aSandbox) {
case GENERIC_UTILITY:
return UtilityActorName::AudioDecoder_Generic;
#ifdef MOZ_APPLEMEDIA
case UTILITY_AUDIO_DECODING_APPLE_MEDIA:
return UtilityActorName::AudioDecoder_AppleMedia;
#endif
#ifdef XP_WIN
case UTILITY_AUDIO_DECODING_WMF:
return UtilityActorName::AudioDecoder_WMF;
#endif
#ifdef MOZ_WMF_MEDIA_ENGINE
case MF_MEDIA_ENGINE_CDM:
return UtilityActorName::MfMediaEngineCDM;
#endif
default:
MOZ_CRASH("Unexpected mSandbox for GetActorName()");
}
}
nsCString GetChildAudioActorName() {
RefPtr<ipc::UtilityProcessChild> s = ipc::UtilityProcessChild::Get();
MOZ_ASSERT(s, "Has UtilityProcessChild");
return nsCString(dom::WebIDLUtilityActorNameValues::GetString(
GetAudioActorName(s->mSandbox)));
}
} // namespace mozilla::ipc

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

@ -0,0 +1,21 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _include_ipc_glue_UtilityAudioDecoder_h__
#define _include_ipc_glue_UtilityAudioDecoder_h__
#include "mozilla/dom/ChromeUtilsBinding.h"
#include "mozilla/ipc/UtilityProcessSandboxing.h"
namespace mozilla::ipc {
using UtilityActorName = mozilla::dom::WebIDLUtilityActorName;
UtilityActorName GetAudioActorName(const SandboxingKind aSandbox);
nsCString GetChildAudioActorName();
} // namespace mozilla::ipc
#endif // _include_ipc_glue_UtilityAudioDecoder_h__

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

@ -13,6 +13,7 @@
#include "mozilla/ipc/Endpoint.h"
#include "mozilla/ipc/UtilityProcessParent.h"
#include "mozilla/ipc/UtilityProcessSandboxing.h"
#include "mozilla/ipc/UtilityAudioDecoder.h"
#include "mozilla/ipc/PUtilityAudioDecoderChild.h"
#ifdef MOZ_WMF_MEDIA_ENGINE
@ -55,26 +56,7 @@ class UtilityAudioDecoderChild final : public PUtilityAudioDecoderChild
const RemoteDecodeIn& aLocation,
const media::MediaCodecsSupported& aSupported);
UtilityActorName GetActorName() {
switch (mSandbox) {
case GENERIC_UTILITY:
return UtilityActorName::AudioDecoder_Generic;
#ifdef MOZ_APPLEMEDIA
case UTILITY_AUDIO_DECODING_APPLE_MEDIA:
return UtilityActorName::AudioDecoder_AppleMedia;
#endif
#ifdef XP_WIN
case UTILITY_AUDIO_DECODING_WMF:
return UtilityActorName::AudioDecoder_WMF;
#endif
#ifdef MOZ_WMF_MEDIA_ENGINE
case MF_MEDIA_ENGINE_CDM:
return UtilityActorName::MfMediaEngineCDM;
#endif
default:
MOZ_CRASH("Unexpected mSandbox for GetActorName()");
}
}
UtilityActorName GetActorName() { return GetAudioActorName(mSandbox); }
nsresult BindToUtilityProcess(RefPtr<UtilityProcessParent> aUtilityParent) {
Endpoint<PUtilityAudioDecoderChild> utilityAudioDecoderChildEnd;

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

@ -67,6 +67,7 @@ EXPORTS.mozilla.ipc += [
"ToplevelActorHolder.h",
"TransportSecurityInfoUtils.h",
"URIUtils.h",
"UtilityAudioDecoder.h",
"UtilityAudioDecoderChild.h",
"UtilityAudioDecoderParent.h",
"UtilityProcessChild.h",
@ -192,6 +193,7 @@ UNIFIED_SOURCES += [
"StringUtil.cpp",
"TransportSecurityInfoUtils.cpp",
"URIUtils.cpp",
"UtilityAudioDecoder.cpp",
"UtilityAudioDecoderChild.cpp",
"UtilityAudioDecoderParent.cpp",
"UtilityProcessChild.cpp",