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/. */
10 // We have to include nsString.h before wgpu_ffi_generated.h because the
11 // latter is wrapped in an extern "C" declaration but ends up including
12 // nsString.h (See bug 1784086)
14 #include "mozilla/UniquePtr.h"
16 // Prelude of types necessary before including wgpu_ffi_generated.h
28 #include "mozilla/webgpu/ffi/wgpu_ffi_generated.h"
36 inline ffi::WGPUByteBuf
* ToFFI(ipc::ByteBuf
* x
) {
37 return reinterpret_cast<ffi::WGPUByteBuf
*>(x
);
39 inline const ffi::WGPUByteBuf
* ToFFI(const ipc::ByteBuf
* x
) {
40 return reinterpret_cast<const ffi::WGPUByteBuf
*>(x
);
46 class DefaultDelete
<webgpu::ffi::WGPUClient
> {
48 void operator()(webgpu::ffi::WGPUClient
* aPtr
) const {
49 webgpu::ffi::wgpu_client_delete(aPtr
);
54 class DefaultDelete
<webgpu::ffi::WGPUGlobal
> {
56 void operator()(webgpu::ffi::WGPUGlobal
* aPtr
) const {
57 webgpu::ffi::wgpu_server_delete(aPtr
);
62 class DefaultDelete
<webgpu::ffi::WGPUMetalSharedEventHandle
> {
64 void operator()(webgpu::ffi::WGPUMetalSharedEventHandle
* aPtr
) const {
65 webgpu::ffi::wgpu_server_delete_metal_shared_event(aPtr
);
69 } // namespace mozilla