Source code

Revision control

Other Tools

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/. */
6
7
#ifndef MOZILLA_LAYERS_OOPCANVASRENDERER_H_
8
#define MOZILLA_LAYERS_OOPCANVASRENDERER_H_
9
10
#include "nsISupportsImpl.h"
11
12
class nsICanvasRenderingContextInternal;
13
14
namespace mozilla {
15
16
namespace dom {
17
class HTMLCanvasElement;
18
}
19
20
namespace layers {
21
class CanvasClient;
22
23
/**
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.
27
*/
28
class OOPCanvasRenderer final {
29
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(OOPCanvasRenderer)
30
31
public:
32
explicit OOPCanvasRenderer(nsICanvasRenderingContextInternal* aContext)
33
: mContext(aContext) {}
34
35
dom::HTMLCanvasElement* mHTMLCanvasElement = nullptr;
36
37
// The ClientWebGLContext that this is for
38
nsICanvasRenderingContextInternal* mContext = nullptr;
39
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;
45
46
private:
47
~OOPCanvasRenderer() = default;
48
};
49
50
} // namespace layers
51
} // namespace mozilla
52
53
#endif // MOZILLA_LAYERS_OOPCANVASRENDERER_H_