Bug 1744524: part 2) Add `WindowContext::GetUserGestureStart` and remove `WindowConte...
[gecko.git] / gfx / layers / ShareableCanvasRenderer.h
blob455d2ccb201b25d755add1bdcc964adffa3e2546
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/. */
7 #ifndef GFX_SHAREABLECANVASRENDERER_H
8 #define GFX_SHAREABLECANVASRENDERER_H
10 #include "CompositorTypes.h"
11 #include "CanvasRenderer.h"
12 #include "mozilla/layers/CanvasClient.h"
14 namespace mozilla {
15 namespace gl {
16 class SurfaceFactory;
17 } // namespace gl
19 namespace gfx {
20 class DrawTarget;
21 } // namespace gfx
23 namespace layers {
25 class ShareableCanvasRenderer : public CanvasRenderer {
26 friend class CanvasClient2D;
27 friend class CanvasClientSharedSurface;
29 protected:
30 RefPtr<CanvasClient> mCanvasClient;
32 private:
33 layers::SurfaceDescriptor mFrontBufferDesc;
34 RefPtr<TextureClient> mFrontBufferFromDesc;
36 public:
37 ShareableCanvasRenderer();
38 virtual ~ShareableCanvasRenderer();
40 public:
41 void Initialize(const CanvasRendererData&) override;
43 virtual CompositableForwarder* GetForwarder() = 0;
45 virtual bool CreateCompositable() = 0;
47 void ClearCachedResources() override;
48 void DisconnectClient() override;
50 void UpdateCompositableClient();
52 CanvasClient* GetCanvasClient() { return mCanvasClient; }
54 private:
55 RefPtr<TextureClient> GetFrontBufferFromDesc(const layers::SurfaceDescriptor&,
56 TextureFlags);
59 } // namespace layers
60 } // namespace mozilla
62 #endif