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/. */
6 #ifndef _include_ipc_glue_UtilityProcessChild_h_
7 #define _include_ipc_glue_UtilityProcessChild_h_
8 #include "mozilla/ipc/PUtilityProcessChild.h"
9 #include "mozilla/ipc/UtilityProcessSandboxing.h"
10 #include "mozilla/UniquePtr.h"
11 #include "ChildProfilerController.h"
13 namespace mozilla::ipc
{
15 class UtilityProcessHost
;
17 class UtilityProcessChild final
: public PUtilityProcessChild
{
19 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UtilityProcessChild
, override
);
21 UtilityProcessChild();
23 static RefPtr
<UtilityProcessChild
> GetSingleton();
24 static RefPtr
<UtilityProcessChild
> Get();
26 SandboxingKind mSandbox
{};
28 bool Init(base::ProcessId aParentPid
, const nsCString
& aParentBuildID
,
29 uint64_t aSandboxingKind
, mozilla::ipc::ScopedPort aPort
);
31 mozilla::ipc::IPCResult
RecvInit(const Maybe
<ipc::FileDescriptor
>& aBrokerFd
,
32 const bool& aCanRecordReleaseTelemetry
);
33 mozilla::ipc::IPCResult
RecvInitProfiler(
34 Endpoint
<PProfilerChild
>&& aEndpoint
);
36 mozilla::ipc::IPCResult
RecvPreferenceUpdate(const Pref
& pref
);
38 mozilla::ipc::IPCResult
RecvRequestMemoryReport(
39 const uint32_t& generation
, const bool& anonymize
,
40 const bool& minimizeMemoryUsage
,
41 const Maybe
<ipc::FileDescriptor
>& DMDFile
,
42 const RequestMemoryReportResolver
& aResolver
);
44 mozilla::ipc::IPCResult
RecvFlushFOGData(FlushFOGDataResolver
&& aResolver
);
46 mozilla::ipc::IPCResult
RecvTestTriggerMetrics(
47 TestTriggerMetricsResolver
&& aResolve
);
49 void ActorDestroy(ActorDestroyReason aWhy
) override
;
51 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
52 mozilla::ipc::IPCResult
RecvInitSandboxTesting(
53 Endpoint
<PSandboxTestingChild
>&& aEndpoint
);
57 friend class UtilityProcessImpl
;
58 ~UtilityProcessChild();
61 RefPtr
<ChildProfilerController
> mProfilerController
;
64 } // namespace mozilla::ipc
66 #endif // _include_ipc_glue_UtilityProcessChild_h_