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_CanvasManagerChild_h__
7 #define _include_gfx_ipc_CanvasManagerChild_h__
9 #include "mozilla/Atomics.h"
10 #include "mozilla/gfx/PCanvasManagerChild.h"
11 #include "mozilla/gfx/Types.h"
12 #include "mozilla/ThreadLocal.h"
25 class DataSourceSurface
;
27 class CanvasManagerChild final
: public PCanvasManagerChild
{
29 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CanvasManagerChild
, override
);
31 explicit CanvasManagerChild(uint32_t aId
);
32 uint32_t Id() const { return mId
; }
33 already_AddRefed
<DataSourceSurface
> GetSnapshot(
34 uint32_t aManagerId
, int32_t aProtocolId
,
35 const layers::CompositableHandle
& aHandle
, SurfaceFormat aFormat
,
36 bool aPremultiply
, bool aYFlip
);
37 void ActorDestroy(ActorDestroyReason aReason
) override
;
39 static CanvasManagerChild
* Get();
40 static void Shutdown();
41 static bool CreateParent(
42 mozilla::ipc::Endpoint
<PCanvasManagerParent
>&& aEndpoint
);
44 RefPtr
<webgpu::WebGPUChild
> GetWebGPUChild();
47 ~CanvasManagerChild();
50 RefPtr
<mozilla::dom::IPCWorkerRef
> mWorkerRef
;
51 RefPtr
<webgpu::WebGPUChild
> mWebGPUChild
;
54 static MOZ_THREAD_LOCAL(CanvasManagerChild
*) sLocalManager
;
55 static Atomic
<uint32_t> sNextId
;
59 } // namespace mozilla
61 #endif // _include_gfx_ipc_CanvasManagerChild_h__