Bug 1852740: add tests for the `fetchpriority` attribute in Link headers. r=necko...
[gecko.git] / dom / webgpu / RenderBundle.cpp
blob0e6ce878742cfa325a15d757f0cef59316735bf1
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 "RenderBundle.h"
9 #include "Device.h"
10 #include "ipc/WebGPUChild.h"
12 namespace mozilla::webgpu {
14 GPU_IMPL_CYCLE_COLLECTION(RenderBundle, mParent)
15 GPU_IMPL_JS_WRAP(RenderBundle)
17 RenderBundle::RenderBundle(Device* const aParent, RawId aId)
18 : ChildOf(aParent), mId(aId) {
19 // If we happened to finish an encoder twice, the second
20 // bundle should be invalid.
21 if (!mId) {
22 mValid = false;
26 RenderBundle::~RenderBundle() { Cleanup(); }
28 void RenderBundle::Cleanup() {
29 if (mValid && mParent) {
30 mValid = false;
31 auto bridge = mParent->GetBridge();
32 if (bridge && bridge->IsOpen()) {
33 bridge->SendRenderBundleDestroy(mId);
38 } // namespace mozilla::webgpu