Bug 1869043 add a main thread record of track audio outputs r=padenot
[gecko.git] / gfx / ipc / GPUChild.h
blob6c2765fcc71f7f3e3ef0804a2d936c379d439491
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_mozilla_gfx_ipc_GPUChild_h_
7 #define _include_mozilla_gfx_ipc_GPUChild_h_
9 #include "mozilla/RefPtr.h"
10 #include "mozilla/UniquePtr.h"
11 #include "mozilla/ipc/CrashReporterHelper.h"
12 #include "mozilla/gfx/PGPUChild.h"
13 #include "mozilla/gfx/gfxVarReceiver.h"
15 namespace mozilla {
17 namespace dom {
18 class MemoryReportRequestHost;
19 } // namespace dom
20 namespace gfx {
22 class GPUProcessHost;
24 class GPUChild final : public ipc::CrashReporterHelper<GeckoProcessType_GPU>,
25 public PGPUChild,
26 public gfxVarReceiver {
27 typedef mozilla::dom::MemoryReportRequestHost MemoryReportRequestHost;
29 public:
30 NS_INLINE_DECL_REFCOUNTING(GPUChild, final)
32 explicit GPUChild(GPUProcessHost* aHost);
34 void Init();
36 bool EnsureGPUReady();
37 void MarkWaitForVarUpdate() { mWaitForVarUpdate = true; }
39 // Notifies that an unexpected GPU process shutdown has been noticed by a
40 // different IPDL actor, and the GPU process is being torn down as a result.
41 // ActorDestroy may receive either NormalShutdown or AbnormalShutdown as a
42 // reason, depending on timings, but either way we treat the shutdown as
43 // abnormal.
44 void OnUnexpectedShutdown();
46 // gfxVarReceiver overrides.
47 void OnVarChanged(const GfxVarUpdate& aVar) override;
49 // PGPUChild overrides.
50 mozilla::ipc::IPCResult RecvInitComplete(const GPUDeviceData& aData);
51 mozilla::ipc::IPCResult RecvDeclareStable();
52 mozilla::ipc::IPCResult RecvReportCheckerboard(const uint32_t& aSeverity,
53 const nsCString& aLog);
54 mozilla::ipc::IPCResult RecvCreateVRProcess();
55 mozilla::ipc::IPCResult RecvShutdownVRProcess();
57 mozilla::ipc::IPCResult RecvAccumulateChildHistograms(
58 nsTArray<HistogramAccumulation>&& aAccumulations);
59 mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms(
60 nsTArray<KeyedHistogramAccumulation>&& aAccumulations);
61 mozilla::ipc::IPCResult RecvUpdateChildScalars(
62 nsTArray<ScalarAction>&& aScalarActions);
63 mozilla::ipc::IPCResult RecvUpdateChildKeyedScalars(
64 nsTArray<KeyedScalarAction>&& aScalarActions);
65 mozilla::ipc::IPCResult RecvRecordChildEvents(
66 nsTArray<ChildEventData>&& events);
67 mozilla::ipc::IPCResult RecvRecordDiscardedData(
68 const DiscardedData& aDiscardedData);
70 void ActorDestroy(ActorDestroyReason aWhy) override;
71 mozilla::ipc::IPCResult RecvGraphicsError(const nsCString& aError);
72 mozilla::ipc::IPCResult RecvNotifyUiObservers(const nsCString& aTopic);
73 mozilla::ipc::IPCResult RecvNotifyDeviceReset(const GPUDeviceData& aData);
74 mozilla::ipc::IPCResult RecvNotifyOverlayInfo(const OverlayInfo aInfo);
75 mozilla::ipc::IPCResult RecvNotifySwapChainInfo(const SwapChainInfo aInfo);
76 mozilla::ipc::IPCResult RecvNotifyDisableRemoteCanvas();
77 mozilla::ipc::IPCResult RecvFlushMemory(const nsString& aReason);
78 mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport);
79 mozilla::ipc::IPCResult RecvUpdateFeature(const Feature& aFeature,
80 const FeatureFailure& aChange);
81 mozilla::ipc::IPCResult RecvUsedFallback(const Fallback& aFallback,
82 const nsCString& aMessage);
83 mozilla::ipc::IPCResult RecvBHRThreadHang(const HangDetails& aDetails);
84 mozilla::ipc::IPCResult RecvUpdateMediaCodecsSupported(
85 const media::MediaCodecsSupported& aSupported);
86 mozilla::ipc::IPCResult RecvFOGData(ByteBuf&& aBuf);
88 bool SendRequestMemoryReport(const uint32_t& aGeneration,
89 const bool& aAnonymize,
90 const bool& aMinimizeMemoryUsage,
91 const Maybe<ipc::FileDescriptor>& aDMDFile);
93 static void Destroy(RefPtr<GPUChild>&& aChild);
95 private:
96 virtual ~GPUChild();
98 GPUProcessHost* mHost;
99 UniquePtr<MemoryReportRequestHost> mMemoryReportRequest;
100 bool mGPUReady;
101 bool mWaitForVarUpdate = false;
102 bool mUnexpectedShutdown = false;
105 } // namespace gfx
106 } // namespace mozilla
108 #endif // _include_mozilla_gfx_ipc_GPUChild_h_