1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/ProcInfo.h"
9 #include "mozilla/UniquePtr.h"
11 #include "nsServiceManagerUtils.h"
12 #include "nsThreadUtils.h"
16 RefPtr
<ProcInfoPromise
> GetProcInfo(nsTArray
<ProcInfoRequest
>&& aRequests
) {
17 auto holder
= MakeUnique
<MozPromiseHolder
<ProcInfoPromise
>>();
18 RefPtr
<ProcInfoPromise
> promise
= holder
->Ensure(__func__
);
21 nsCOMPtr
<nsIEventTarget
> target
=
22 do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID
, &rv
);
24 NS_WARNING("Failed to get stream transport service");
25 holder
->Reject(rv
, __func__
);
29 RefPtr
<nsIRunnable
> r
= NS_NewRunnableFunction(
31 [holder
= std::move(holder
),
32 requests
= std::move(aRequests
)]() mutable -> void {
33 holder
->ResolveOrReject(GetProcInfoSync(std::move(requests
)), __func__
);
36 rv
= target
->Dispatch(r
.forget(), NS_DISPATCH_NORMAL
);
38 NS_WARNING("Failed to dispatch the LoadDataRunnable.");
44 nsCString
GetUtilityActorName(const UtilityActorName aActorName
) {
46 case UtilityActorName::Unknown
:
48 case UtilityActorName::AudioDecoder_Generic
:
49 return "audio-decoder-generic"_ns
;
50 case UtilityActorName::AudioDecoder_AppleMedia
:
51 return "audio-decoder-applemedia"_ns
;
52 case UtilityActorName::AudioDecoder_WMF
:
53 return "audio-decoder-wmf"_ns
;
54 case UtilityActorName::MfMediaEngineCDM
:
55 return "mf-media-engine"_ns
;
56 case UtilityActorName::JSOracle
:
57 return "js-oracle"_ns
;
58 case UtilityActorName::WindowsUtils
:
59 return "windows-utils"_ns
;
60 case UtilityActorName::WindowsFileDialog
:
61 return "windows-file-dialog"_ns
;
67 } // namespace mozilla