RDDChild.h (3100B)
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_dom_media_ipc_RDDChild_h_ 7 #define _include_dom_media_ipc_RDDChild_h_ 8 #include "mozilla/PRDDChild.h" 9 #include "mozilla/UniquePtr.h" 10 #include "mozilla/gfx/GPUProcessListener.h" 11 #include "mozilla/gfx/gfxVarReceiver.h" 12 #include "mozilla/ipc/CrashReporterHelper.h" 13 14 namespace mozilla { 15 16 #if defined(XP_LINUX) && defined(MOZ_SANDBOX) 17 class SandboxBroker; 18 #endif 19 20 namespace dom { 21 class MemoryReportRequestHost; 22 } // namespace dom 23 24 class RDDProcessHost; 25 26 class RDDChild final : public PRDDChild, 27 public ipc::CrashReporterHelper<RDDChild>, 28 public gfx::gfxVarReceiver, 29 public gfx::GPUProcessListener { 30 typedef mozilla::dom::MemoryReportRequestHost MemoryReportRequestHost; 31 32 public: 33 static constexpr GeckoProcessType PROCESS_TYPE = GeckoProcessType_RDD; 34 35 NS_INLINE_DECL_REFCOUNTING(RDDChild, final) 36 37 explicit RDDChild(RDDProcessHost* aHost); 38 39 bool Init(); 40 41 void OnCompositorUnexpectedShutdown() override; 42 void OnVarChanged(const nsTArray<GfxVarUpdate>& aVar) override; 43 44 void ActorDestroy(ActorDestroyReason aWhy) override; 45 46 mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport); 47 #if defined(XP_WIN) 48 mozilla::ipc::IPCResult RecvGetModulesTrust( 49 ModulePaths&& aModPaths, bool aRunAtNormalPriority, 50 GetModulesTrustResolver&& aResolver); 51 #endif // defined(XP_WIN) 52 mozilla::ipc::IPCResult RecvUpdateMediaCodecsSupported( 53 const media::MediaCodecsSupported& aSupported); 54 mozilla::ipc::IPCResult RecvFOGData(ByteBuf&& aBuf); 55 56 mozilla::ipc::IPCResult RecvAccumulateChildHistograms( 57 nsTArray<HistogramAccumulation>&& aAccumulations); 58 mozilla::ipc::IPCResult RecvAccumulateChildKeyedHistograms( 59 nsTArray<KeyedHistogramAccumulation>&& aAccumulations); 60 mozilla::ipc::IPCResult RecvUpdateChildScalars( 61 nsTArray<ScalarAction>&& aScalarActions); 62 mozilla::ipc::IPCResult RecvUpdateChildKeyedScalars( 63 nsTArray<KeyedScalarAction>&& aScalarActions); 64 mozilla::ipc::IPCResult RecvRecordChildEvents( 65 nsTArray<ChildEventData>&& events); 66 mozilla::ipc::IPCResult RecvRecordDiscardedData( 67 const DiscardedData& aDiscardedData); 68 69 bool SendRequestMemoryReport(const uint32_t& aGeneration, 70 const bool& aAnonymize, 71 const bool& aMinimizeMemoryUsage, 72 const Maybe<ipc::FileDescriptor>& aDMDFile); 73 74 static void Destroy(RefPtr<RDDChild>&& aChild); 75 76 private: 77 ~RDDChild(); 78 79 RDDProcessHost* mHost; 80 UniquePtr<MemoryReportRequestHost> mMemoryReportRequest; 81 #if defined(XP_LINUX) && defined(MOZ_SANDBOX) 82 RefPtr<SandboxBroker> mSandboxBroker; 83 #endif 84 }; 85 86 } // namespace mozilla 87 88 #endif // _include_dom_media_ipc_RDDChild_h_