Merge mozilla-central to autoland on a CLOSED TREE
[gecko.git] / dom / webgpu / PipelineLayout.cpp
blob21485e78a50191db5d6954ad8615d5a1fbf53ae6
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "mozilla/dom/WebGPUBinding.h"
7 #include "PipelineLayout.h"
8 #include "ipc/WebGPUChild.h"
10 #include "Device.h"
12 namespace mozilla::webgpu {
14 GPU_IMPL_CYCLE_COLLECTION(PipelineLayout, mParent)
15 GPU_IMPL_JS_WRAP(PipelineLayout)
17 PipelineLayout::PipelineLayout(Device* const aParent, RawId aId)
18 : ChildOf(aParent), mId(aId) {
19 if (!aId) {
20 mValid = false;
24 PipelineLayout::~PipelineLayout() { Cleanup(); }
26 void PipelineLayout::Cleanup() {
27 if (mValid && mParent) {
28 mValid = false;
29 auto bridge = mParent->GetBridge();
30 if (bridge && bridge->IsOpen()) {
31 bridge->SendPipelineLayoutDestroy(mId);
36 } // namespace mozilla::webgpu