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 MOZILLA_LAYERS_OOPCANVASRENDERER_H_
8 #define MOZILLA_LAYERS_OOPCANVASRENDERER_H_
10 #include "nsISupportsImpl.h"
12 class nsICanvasRenderingContextInternal
;
17 class HTMLCanvasElement
;
24 * This renderer works with WebGL running in the host process. It does
25 * not perform any graphics operations itself -- it is the client-side
26 * representation. It forwards WebGL composition to the remote process.
28 class OOPCanvasRenderer final
{
29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OOPCanvasRenderer
)
32 explicit OOPCanvasRenderer(nsICanvasRenderingContextInternal
* aContext
)
33 : mContext(aContext
) {}
35 dom::HTMLCanvasElement
* mHTMLCanvasElement
= nullptr;
37 // The ClientWebGLContext that this is for
38 nsICanvasRenderingContextInternal
* mContext
= nullptr;
40 // The lifetime of this pointer is controlled by OffscreenCanvas
41 // Can be accessed in active thread and ImageBridge thread.
42 // But we never accessed it at the same time on both thread. So no
43 // need to protect this member.
44 CanvasClient
* mCanvasClient
= nullptr;
47 ~OOPCanvasRenderer() = default;
51 } // namespace mozilla
53 #endif // MOZILLA_LAYERS_OOPCANVASRENDERER_H_