From 6bf0a5cb5034a7e684dcc3500e841785237ce2dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:32:43 +0200 Subject: Adding upstream version 1:115.7.0. Signed-off-by: Daniel Baumann --- gfx/vr/ipc/VRLayerChild.h | 76 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 gfx/vr/ipc/VRLayerChild.h (limited to 'gfx/vr/ipc/VRLayerChild.h') diff --git a/gfx/vr/ipc/VRLayerChild.h b/gfx/vr/ipc/VRLayerChild.h new file mode 100644 index 0000000000..de91a46b87 --- /dev/null +++ b/gfx/vr/ipc/VRLayerChild.h @@ -0,0 +1,76 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef GFX_VR_LAYERCHILD_H +#define GFX_VR_LAYERCHILD_H + +#include "VRManagerChild.h" + +#include "mozilla/RefPtr.h" +#include "mozilla/gfx/PVRLayerChild.h" +#include "gfxVR.h" + +class nsICanvasRenderingContextInternal; + +namespace mozilla { +class WebGLContext; +class WebGLFramebufferJS; +namespace dom { +class HTMLCanvasElement; +} +namespace layers { +class SharedSurfaceTextureClient; +} +namespace gl { +class SurfaceFactory; +} +namespace gfx { + +class VRLayerChild : public PVRLayerChild { + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRLayerChild) + + public: + static PVRLayerChild* CreateIPDLActor(); + static bool DestroyIPDLActor(PVRLayerChild* actor); + + void Initialize(dom::HTMLCanvasElement* aCanvasElement, + const gfx::Rect& aLeftEyeRect, + const gfx::Rect& aRightEyeRect); + void SetXRFramebuffer(WebGLFramebufferJS*); + void SubmitFrame(const VRDisplayInfo& aDisplayInfo); + bool IsIPCOpen(); + + private: + VRLayerChild(); + virtual ~VRLayerChild(); + void ClearSurfaces(); + virtual void ActorDestroy(ActorDestroyReason aWhy) override; + + RefPtr mCanvasElement; + bool mIPCOpen = false; + + // AddIPDLReference and ReleaseIPDLReference are only to be called by + // CreateIPDLActor and DestroyIPDLActor, respectively. We intentionally make + // them private to prevent misuse. The purpose of these methods is to be aware + // of when the IPC system around this actor goes down: mIPCOpen is then set to + // false. + void AddIPDLReference(); + void ReleaseIPDLReference(); + + gfx::Rect mLeftEyeRect; + gfx::Rect mRightEyeRect; + RefPtr mFramebuffer; + + Maybe mThisFrameTextureDesc; + Maybe mLastFrameTextureDesc; + + uint64_t mLastSubmittedFrameId = 0; +}; + +} // namespace gfx +} // namespace mozilla + +#endif -- cgit v1.2.3