1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2  * This Source Code Form is subject to the terms of the Mozilla Public
3  * License, v. 2.0. If a copy of the MPL was not distributed with this
4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 
6 #ifndef GFX_VR_LAYERCHILD_H
7 #define GFX_VR_LAYERCHILD_H
8 
9 #include "VRManagerChild.h"
10 
11 #include "mozilla/RefPtr.h"
12 #include "mozilla/gfx/PVRLayerChild.h"
13 #include "GLContext.h"
14 #include "gfxVR.h"
15 
16 class nsICanvasRenderingContextInternal;
17 
18 namespace mozilla {
19 class WebGLContext;
20 namespace dom {
21 class HTMLCanvasElement;
22 }
23 namespace layers {
24 class SharedSurfaceTextureClient;
25 }
26 namespace gl {
27 class SurfaceFactory;
28 }
29 namespace gfx {
30 
31 class VRLayerChild : public PVRLayerChild {
32   NS_INLINE_DECL_REFCOUNTING(VRLayerChild)
33 
34 public:
35   VRLayerChild(uint32_t aVRDisplayID, VRManagerChild* aVRManagerChild);
36   void Initialize(dom::HTMLCanvasElement* aCanvasElement);
37   void SubmitFrame();
38 
39 protected:
40   virtual ~VRLayerChild();
41   void ClearSurfaces();
42 
43   uint32_t mVRDisplayID;
44 
45   RefPtr<dom::HTMLCanvasElement> mCanvasElement;
46   RefPtr<layers::SharedSurfaceTextureClient> mShSurfClient;
47   RefPtr<layers::TextureClient> mFront;
48 };
49 
50 } // namespace gfx
51 } // namespace mozilla
52 
53 #endif
54