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"
18 class MemoryReportRequestHost
;
24 class GPUChild final
: public ipc::CrashReporterHelper
<GeckoProcessType_GPU
>,
26 public gfxVarReceiver
{
27 typedef mozilla::dom::MemoryReportRequestHost MemoryReportRequestHost
;
30 explicit GPUChild(GPUProcessHost
* aHost
);
35 bool EnsureGPUReady();
36 base::ProcessHandle
GetChildProcessHandle();
38 // gfxVarReceiver overrides.
39 void OnVarChanged(const GfxVarUpdate
& aVar
) override
;
41 // PGPUChild overrides.
42 mozilla::ipc::IPCResult
RecvInitComplete(const GPUDeviceData
& aData
);
43 mozilla::ipc::IPCResult
RecvReportCheckerboard(const uint32_t& aSeverity
,
44 const nsCString
& aLog
);
45 mozilla::ipc::IPCResult
RecvCreateVRProcess();
46 mozilla::ipc::IPCResult
RecvShutdownVRProcess();
48 mozilla::ipc::IPCResult
RecvAccumulateChildHistograms(
49 nsTArray
<HistogramAccumulation
>&& aAccumulations
);
50 mozilla::ipc::IPCResult
RecvAccumulateChildKeyedHistograms(
51 nsTArray
<KeyedHistogramAccumulation
>&& aAccumulations
);
52 mozilla::ipc::IPCResult
RecvUpdateChildScalars(
53 nsTArray
<ScalarAction
>&& aScalarActions
);
54 mozilla::ipc::IPCResult
RecvUpdateChildKeyedScalars(
55 nsTArray
<KeyedScalarAction
>&& aScalarActions
);
56 mozilla::ipc::IPCResult
RecvRecordChildEvents(
57 nsTArray
<ChildEventData
>&& events
);
58 mozilla::ipc::IPCResult
RecvRecordDiscardedData(
59 const DiscardedData
& aDiscardedData
);
61 void ActorDestroy(ActorDestroyReason aWhy
) override
;
62 mozilla::ipc::IPCResult
RecvGraphicsError(const nsCString
& aError
);
63 mozilla::ipc::IPCResult
RecvNotifyUiObservers(const nsCString
& aTopic
);
64 mozilla::ipc::IPCResult
RecvNotifyDeviceReset(const GPUDeviceData
& aData
);
65 mozilla::ipc::IPCResult
RecvFlushMemory(const nsString
& aReason
);
66 mozilla::ipc::IPCResult
RecvAddMemoryReport(const MemoryReport
& aReport
);
67 mozilla::ipc::IPCResult
RecvUpdateFeature(const Feature
& aFeature
,
68 const FeatureFailure
& aChange
);
69 mozilla::ipc::IPCResult
RecvUsedFallback(const Fallback
& aFallback
,
70 const nsCString
& aMessage
);
71 mozilla::ipc::IPCResult
RecvBHRThreadHang(const HangDetails
& aDetails
);
72 mozilla::ipc::IPCResult
RecvUpdateMediaCodecsSupported(
73 const PDMFactory::MediaCodecsSupported
& aSupported
);
75 bool SendRequestMemoryReport(const uint32_t& aGeneration
,
76 const bool& aAnonymize
,
77 const bool& aMinimizeMemoryUsage
,
78 const Maybe
<ipc::FileDescriptor
>& aDMDFile
);
80 static void Destroy(UniquePtr
<GPUChild
>&& aChild
);
83 GPUProcessHost
* mHost
;
84 UniquePtr
<MemoryReportRequestHost
> mMemoryReportRequest
;
89 } // namespace mozilla
91 #endif // _include_mozilla_gfx_ipc_GPUChild_h_