tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

GPUParent.h (5646B)


      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_gfx_ipc_GPUParent_h__
      7 #define _include_gfx_ipc_GPUParent_h__
      8 
      9 #include "mozilla/RefPtr.h"
     10 #include "mozilla/gfx/PGPUParent.h"
     11 #include "mozilla/ipc/AsyncBlockers.h"
     12 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
     13 #  include "mozilla/PSandboxTestingChild.h"
     14 #endif
     15 
     16 namespace mozilla {
     17 
     18 class TimeStamp;
     19 class ChildProfilerController;
     20 
     21 namespace gfx {
     22 
     23 class VsyncBridgeParent;
     24 
     25 class GPUParent final : public PGPUParent {
     26 public:
     27  NS_INLINE_DECL_REFCOUNTING(GPUParent, final)
     28 
     29  GPUParent();
     30 
     31  static GPUParent* GetSingleton();
     32 
     33  ipc::AsyncBlockers& AsyncShutdownService() { return mShutdownBlockers; }
     34 
     35  // Gets the name of the GPU process, in the format expected by about:memory.
     36  // There must be a GPU process active, and the caller must be either in that
     37  // process or the parent process.
     38  static void GetGPUProcessName(nsACString& aStr);
     39 
     40  // Check for memory pressure and notify the parent process if necessary.
     41  static bool MaybeFlushMemory();
     42 
     43  bool Init(mozilla::ipc::UntypedEndpoint&& aEndpoint,
     44            const char* aParentBuildID);
     45  void NotifyDeviceReset(DeviceResetReason aReason,
     46                         DeviceResetDetectPlace aPlace);
     47  void NotifyOverlayInfo(layers::OverlayInfo aInfo);
     48  void NotifySwapChainInfo(layers::SwapChainInfo aInfo);
     49  void NotifyDisableRemoteCanvas();
     50 
     51  mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
     52                                   const DevicePrefs& devicePrefs,
     53                                   nsTArray<LayerTreeIdMapping>&& mappings,
     54                                   nsTArray<GfxInfoFeatureStatus>&& features,
     55                                   uint32_t wrNamespace,
     56                                   InitResolver&& aInitResolver);
     57  mozilla::ipc::IPCResult RecvInitCompositorManager(
     58      Endpoint<PCompositorManagerParent>&& aEndpoint, uint32_t aNamespace);
     59  mozilla::ipc::IPCResult RecvInitVsyncBridge(
     60      Endpoint<PVsyncBridgeParent>&& aVsyncEndpoint);
     61  mozilla::ipc::IPCResult RecvInitImageBridge(
     62      Endpoint<PImageBridgeParent>&& aEndpoint);
     63  mozilla::ipc::IPCResult RecvInitVideoBridge(
     64      Endpoint<PVideoBridgeParent>&& aEndpoint,
     65      const layers::VideoBridgeSource& aSource);
     66  mozilla::ipc::IPCResult RecvInitVRManager(
     67      Endpoint<PVRManagerParent>&& aEndpoint);
     68  mozilla::ipc::IPCResult RecvInitVR(Endpoint<PVRGPUChild>&& aVRGPUChild);
     69  mozilla::ipc::IPCResult RecvInitUiCompositorController(
     70      const LayersId& aRootLayerTreeId,
     71      Endpoint<PUiCompositorControllerParent>&& aEndpoint);
     72  mozilla::ipc::IPCResult RecvInitAPZInputBridge(
     73      const LayersId& aRootLayerTreeId,
     74      Endpoint<PAPZInputBridgeParent>&& aEndpoint);
     75  mozilla::ipc::IPCResult RecvInitProfiler(
     76      Endpoint<PProfilerChild>&& aEndpoint);
     77  mozilla::ipc::IPCResult RecvUpdateVar(const nsTArray<GfxVarUpdate>& var);
     78  mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
     79  mozilla::ipc::IPCResult RecvScreenInformationChanged();
     80  mozilla::ipc::IPCResult RecvNotifyBatteryInfo(
     81      const BatteryInformation& aBatteryInfo);
     82  mozilla::ipc::IPCResult RecvNewContentCompositorManager(
     83      Endpoint<PCompositorManagerParent>&& aEndpoint,
     84      const ContentParentId& aChildId, uint32_t aNamespace);
     85  mozilla::ipc::IPCResult RecvNewContentImageBridge(
     86      Endpoint<PImageBridgeParent>&& aEndpoint,
     87      const ContentParentId& aChildId);
     88  mozilla::ipc::IPCResult RecvNewContentVRManager(
     89      Endpoint<PVRManagerParent>&& aEndpoint, const ContentParentId& aChildId);
     90  mozilla::ipc::IPCResult RecvNewContentRemoteMediaManager(
     91      Endpoint<PRemoteMediaManagerParent>&& aEndpoint,
     92      const ContentParentId& aChildId);
     93  mozilla::ipc::IPCResult RecvGetDeviceStatus(GPUDeviceData* aOutStatus);
     94  mozilla::ipc::IPCResult RecvSimulateDeviceReset();
     95  mozilla::ipc::IPCResult RecvAddLayerTreeIdMapping(
     96      const LayerTreeIdMapping& aMapping);
     97  mozilla::ipc::IPCResult RecvRemoveLayerTreeIdMapping(
     98      const LayerTreeIdMapping& aMapping);
     99  mozilla::ipc::IPCResult RecvNotifyGpuObservers(const nsCString& aTopic);
    100  mozilla::ipc::IPCResult RecvRequestMemoryReport(
    101      const uint32_t& generation, const bool& anonymize,
    102      const bool& minimizeMemoryUsage,
    103      const Maybe<ipc::FileDescriptor>& DMDFile,
    104      const RequestMemoryReportResolver& aResolver);
    105  mozilla::ipc::IPCResult RecvShutdownVR();
    106 
    107  mozilla::ipc::IPCResult RecvUpdatePerfStatsCollectionMask(
    108      const uint64_t& aMask);
    109  mozilla::ipc::IPCResult RecvCollectPerfStatsJSON(
    110      CollectPerfStatsJSONResolver&& aResolver);
    111 
    112 #if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
    113  mozilla::ipc::IPCResult RecvInitSandboxTesting(
    114      Endpoint<PSandboxTestingChild>&& aEndpoint);
    115 #endif
    116 
    117  mozilla::ipc::IPCResult RecvFlushFOGData(FlushFOGDataResolver&& aResolver);
    118 
    119  mozilla::ipc::IPCResult RecvTestTriggerMetrics(
    120      TestTriggerMetricsResolver&& aResolve);
    121 
    122  mozilla::ipc::IPCResult RecvCrashProcess();
    123 
    124  void ActorDestroy(ActorDestroyReason aWhy) override;
    125 
    126 private:
    127  ~GPUParent();
    128 
    129  const TimeStamp mLaunchTime;
    130  RefPtr<VsyncBridgeParent> mVsyncBridge;
    131  RefPtr<ChildProfilerController> mProfilerController;
    132  ipc::AsyncBlockers mShutdownBlockers;
    133 };
    134 
    135 }  // namespace gfx
    136 }  // namespace mozilla
    137 
    138 #endif  // _include_gfx_ipc_GPUParent_h__