Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / ipc / CanvasManagerParent.h
blob1eaadc3ad5b09b0f37bc8b9cb07565d66a11ccb9
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 #ifndef _include_gfx_ipc_CanvasManagerParent_h__
7 #define _include_gfx_ipc_CanvasManagerParent_h__
9 #include "mozilla/gfx/PCanvasManagerParent.h"
10 #include "mozilla/dom/ipc/IdType.h"
11 #include "mozilla/StaticMonitor.h"
12 #include "mozilla/UniquePtr.h"
13 #include "nsHashtablesFwd.h"
14 #include "nsTArray.h"
16 namespace mozilla {
17 namespace layers {
18 class CanvasTranslator;
19 class HostIPCAllocator;
20 class SharedSurfacesHolder;
21 class SurfaceDescriptor;
22 } // namespace layers
24 namespace gfx {
26 class CanvasManagerParent final : public PCanvasManagerParent {
27 public:
28 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CanvasManagerParent, override);
30 static void Init(Endpoint<PCanvasManagerParent>&& aEndpoint,
31 layers::SharedSurfacesHolder* aSharedSurfacesHolder,
32 const dom::ContentParentId& aContentId);
34 static void Shutdown();
36 static void DisableRemoteCanvas();
38 CanvasManagerParent(layers::SharedSurfacesHolder* aSharedSurfacesHolder,
39 const dom::ContentParentId& aContentId);
41 void Bind(Endpoint<PCanvasManagerParent>&& aEndpoint);
42 void ActorDestroy(ActorDestroyReason aWhy) override;
44 already_AddRefed<dom::PWebGLParent> AllocPWebGLParent();
45 already_AddRefed<webgpu::PWebGPUParent> AllocPWebGPUParent();
46 already_AddRefed<layers::PCanvasParent> AllocPCanvasParent();
48 mozilla::ipc::IPCResult RecvInitialize(const uint32_t& aId);
49 mozilla::ipc::IPCResult RecvGetSnapshot(
50 const uint32_t& aManagerId, const int32_t& aProtocolId,
51 const Maybe<RemoteTextureOwnerId>& aOwnerId,
52 webgl::FrontBufferSnapshotIpc* aResult);
54 private:
55 static void ShutdownInternal();
56 static void DisableRemoteCanvasInternal();
58 ~CanvasManagerParent() override;
60 RefPtr<layers::SharedSurfacesHolder> mSharedSurfacesHolder;
61 const dom::ContentParentId mContentId;
62 uint32_t mId = 0;
64 using ManagerSet = nsTHashSet<RefPtr<CanvasManagerParent>>;
65 static ManagerSet sManagers;
68 } // namespace gfx
69 } // namespace mozilla
71 #endif // _include_gfx_ipc_CanvasManagerParent_h__