tor-browser

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

VRChild.h (2163B)


      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 
      7 #ifndef GFX_VR_CHILD_H
      8 #define GFX_VR_CHILD_H
      9 
     10 #include "mozilla/gfx/PVRChild.h"
     11 #include "mozilla/gfx/gfxVarReceiver.h"
     12 #include "mozilla/ipc/CrashReporterHelper.h"
     13 #include "mozilla/VsyncDispatcher.h"
     14 #include "moz_external_vr.h"
     15 
     16 namespace mozilla {
     17 namespace dom {
     18 class MemoryReportRequestHost;
     19 }  // namespace dom
     20 namespace gfx {
     21 
     22 class VRProcessParent;
     23 class VRChild;
     24 
     25 class VRChild final : public PVRChild,
     26                      public ipc::CrashReporterHelper<VRChild>,
     27                      public gfxVarReceiver {
     28  typedef mozilla::dom::MemoryReportRequestHost MemoryReportRequestHost;
     29  friend class PVRChild;
     30 
     31 public:
     32  static constexpr GeckoProcessType PROCESS_TYPE = GeckoProcessType_VR;
     33 
     34  NS_INLINE_DECL_REFCOUNTING(VRChild, final)
     35 
     36  explicit VRChild(VRProcessParent* aHost);
     37 
     38  static void Destroy(RefPtr<VRChild>&& aChild);
     39  void Init();
     40  bool EnsureVRReady();
     41  void OnVarChanged(const nsTArray<GfxVarUpdate>& aVar) override;
     42  bool SendRequestMemoryReport(const uint32_t& aGeneration,
     43                               const bool& aAnonymize,
     44                               const bool& aMinimizeMemoryUsage,
     45                               const Maybe<ipc::FileDescriptor>& aDMDFile);
     46 
     47 protected:
     48  virtual void ActorDestroy(ActorDestroyReason aWhy) override;
     49  mozilla::ipc::IPCResult RecvOpenVRControllerActionPathToParent(
     50      const nsCString& aPath);
     51  mozilla::ipc::IPCResult RecvOpenVRControllerManifestPathToParent(
     52      const VRControllerType& aType, const nsCString& aPath);
     53  mozilla::ipc::IPCResult RecvInitComplete();
     54 
     55  mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport);
     56 
     57 private:
     58  ~VRChild();
     59 
     60  VRProcessParent* mHost;
     61  UniquePtr<MemoryReportRequestHost> mMemoryReportRequest;
     62  bool mVRReady;
     63 };
     64 
     65 }  // namespace gfx
     66 }  // namespace mozilla
     67 
     68 #endif  // GFX_VR_CHILD_H