Bug 1883287 - Don't wait for the hidden window to be created on Linux to load the...
[gecko.git] / gfx / layers / ShareableCanvasRenderer.h
blob0e72f9bace001696cd9dde7dc8ba729bb265e472
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;
46 virtual void EnsurePipeline() = 0;
47 virtual bool HasPipeline() { return false; };
49 void ClearCachedResources() override;
50 void DisconnectClient() override;
52 void UpdateCompositableClient();
54 CanvasClient* GetCanvasClient() { return mCanvasClient; }
56 private:
57 RefPtr<TextureClient> GetFrontBufferFromDesc(const layers::SurfaceDescriptor&,
58 TextureFlags);
61 } // namespace layers
62 } // namespace mozilla
64 #endif